环境:centos
注意:jenkins对centos的支持只到2024.9
一、安装java
推荐安装java 11, 但是jenkins现在已经支持到java 17了。
yum install java-11-openjdk
二、安装jenkins
wget https://pkg.jenkins.io/redhat-stable/jenkins.repo -O /etc/yum.repos.d/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
# 上面这个key不行,到stackoverflow上找到的下面这个key可以
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
yum upgrade
# 安装指定版本2.346.1
yum install jenkins-2.346.1
# 安装最新版本
yum install jenkins
yum install jenkins是安装最新版本,安装指定版本用:yum install jenkins-version
三、启动jenkins
systemctl daemon-reload
systemctl start jenkins
systemctl status jenkins
用http://ip:8080 访问jenkins服务。
jenkins 安装后目录
/usr/share/java/jenkins.war # java包
/var/lib/jenkins # jenkins程序执行文件
/usr/bin/jenkins # jenkins HOME
/usr/lib/systemd/system/jenkins.service # 启动脚本