1. 下载rpm包(rpm包网址:https://pkg.jenkins.io/redhat-stable/)
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
2. 导出密钥(若之前已从Jenkins导入过密钥,“rpm--import”将失败,请忽略,继续执行下面)
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
3. 安装Jenkins
yum install -y jenkins
4. 查看jenkins安装信息
[root@one ~]# rpm -ql jenkins /etc/init.d/jenkins /etc/logrotate.d/jenkins /etc/sysconfig/jenkins # jenkins配置文件 /usr/lib/jenkins # jenkins安装目录 /usr/lib/jenkins/jenkins.war /usr/sbin/rcjenkins /var/cache/jenkins /var/lib/jenkins # 默认JENKINS_HOME /var/log/jenkins # jenkins日志目录
5. 配置jenkins
#打开配置文件
vim /etc/sysconfig/jenkins
#jenkins默认端口8080,若被占用或想更换端口,修改JENKINS_PORT的值
JENKINS_PORT="端口号"
6. 启动jenkins
systemctl start jenkins.service
7. 运行jenkins项目,配置项目
#浏览器打开Jenkins项目(如果是云服务器,要在安全组规则中开启该端口) IP:你设置的端口 #解锁Jenkins 将服务器 /var/lib/jenkins/secrets/initialAdminPassword 中管理员密码输入到验证框 #若出现该Jenkins实例似乎已离线 解决方法:https://blog.csdn.net/qq_34272964/article/details/93500813
#按要求选择经典安装(新手建议选择)或则自定义安装,之后注册管理员帐号
8. 卸载
rpm -e jenkins #rpm卸载 rpm -ql jenkins #检查是否卸载成功 find / -iname jenkins | xargs -n 1000 rm -rf 彻底删除残留文件
原文链接:https://blog.csdn.net/qq_34272964/article/details/93474659