Jenkins
安装部署
RHEL
安装
bash
# 镜像
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
#
yum -y install fontconfig
yum -y install java-17-openjdk.x86_64 java-17-openjdk-devel.x86_64 java-17-openjdk-headless.x86_64
yum -y install jenkins
bash
# 新建数据目录和日志目录
mkdir -p /data/app/data/jenkins
mkdir -p /data/app/build
# 赋予目录权限
chown -R jenkins.jenkins /data/app/data/jenkins
chown -R jenkins.jenkins /data/app/build
# 开启自启动
sudo systemctl enable jenkins
# 打开配置文件
vi /usr/lib/systemd/system/jenkins.service
# 修改下面变量,其他网上介绍的方式都无效
Environment="JENKINS_PORT=8888"
Environment="JENKINS_HOME=/data/app/data/jenkins"
WorkingDirectory=/data/app/data/jenkins
系统服务
bash
sudo systemctl enable jenkins
sudo systemctl disable jenkins
sudo systemctl start jenkins
sudo systemctl stop jenkins
sudo systemctl restart jenkins
sudo systemctl status jenkins
systemctl daemon-reload
卸载
bash
sudo systemctl stop jenkins.service
sudo rpm -e jenkins
sudo rpm -qa | grep jenkins
sudo rm -rf /etc/sysconfig/jenkins.rpmsave
sudo rm -rf /var/cache/jenkins/
sudo rm -rf /var/lib/jenkins/
sudo rm -rf /var/log/jenkins
sudo rm -rf /usr/lib/jenkins