点击 - Red Hat Enterprise Linux and derivatives
点击### Long Term Support release
1,按照如下命令执行安装
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
sudo yum upgrade
# Add required dependencies for the jenkins package
sudo yum install fontconfig java-21-openjdk
sudo yum install jenkins
sudo systemctl daemon-reload
2,按照如下命令执行启动
Start Jenkins
You can enable the Jenkins service to start at boot with the command:
sudo systemctl enable jenkins
You can start the Jenkins service with the command:
sudo systemctl start jenkins
You can check the status of the Jenkins service using the command:
sudo systemctl status jenkins
3,修改配置文件 jdk版本和端口
vim /usr/lib/systemd/system/jenkins.service
## 指定 jdk版本(17版本jdk须提前安装如: sudo yum install fontconfig java-17-openjdk)
#Environment="JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64"
Environment="JAVA_HOME=/usr/lib/jvm/java-17-openjdk-17.0.1.0.12-2.el8_5.x86_64"
# 指定端口
# directive below.
Environment="JENKINS_PORT=8282"
4,再次启动
[root@localhost ~]# systemctl start jenkins
Warning: The unit file, source configuration file or drop-ins of jenkins.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Job for jenkins.service failed because the control process exited with error code.
See "systemctl status jenkins.service" and "journalctl -xe" for details.
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl start jenkins