要在 CentOS 上更新 Jenkins,您需要执行以下步骤:
sudo yum install java-1.8.0-openjdk-devel
wget
命令下载最新版本的 Jenkins WAR 文件:wget https://pkg.jenkins.io/redhat-stable/jenkins.war
sudo systemctl stop jenkins
sudo rm -rf /var/lib/jenkins
sudo mkdir -p /var/lib/jenkins
sudo chown -R jenkins:jenkins /var/lib/jenkins
sudo mv jenkins.war /var/lib/jenkins/jenkins.war
sudo nano /etc/systemd/system/jenkins.service
[Unit]
Description=Jenkins
After=syslog.target network.target
[Service]
User=jenkins
Group=jenkins
WorkingDirectory=/var/lib/jenkins
ExecStart=/usr/bin/java -Djava.awt.headless=true -jar /var/lib/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080
Restart=always
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl start jenkins
sudo systemctl enable jenkins
http://<your_server_ip>:8080
,使用默认的 Jenkins 用户名(admin)和密码(admin)登录。现在,您已经在 CentOS 上成功更新了 Jenkins 版本。如果需要进一步更新,只需重复上述步骤并下载新版本的 Jenkins WAR 文件即可。