1、下载
注意:至少安装2.319的版本,否则插件安装失败,2.357 之后版本需要java11,请注意java版本
![](https://i-blog.csdnimg.cn/blog_migrate/42b50e1620afe3c8f4358aed643e05ea.png)
a、开始下载,利用华为云地址 https://mirrors.huaweicloud.com/home,速度杠杠快
搜索jenkins,点击jenkins,选择继续使用(免登录)
![](https://i-blog.csdnimg.cn/blog_migrate/f628873723b0485879d491ae0b3f6ee6.png)
![](https://i-blog.csdnimg.cn/blog_migrate/102d202bb31540f3dd98d59947b9f539.png)
b、选择版本
![](https://i-blog.csdnimg.cn/blog_migrate/3e81451b4991b708201bf9cda8c75cc5.png)
![](https://i-blog.csdnimg.cn/blog_migrate/181d448866a74762e0eef3b70bafe39b.png)
利用wget开始下载:
wget https://repo.huaweicloud.com/jenkins/redhat-stable/jenkins-2.319.3-1.1.noarch.rpm
2、安装epel-release、daemonize
jenkins 2.319版本会依赖daemonize,不安装会报错
![](https://i-blog.csdnimg.cn/blog_migrate/44262ea9b04ad4182ee682002bcc7cae.png)
yum -y install epel-release
yum -y install daemonize
3、安装jenkins
rpm -ivh jenkins-2.319.3-1.1.noarch.rpm
4、启动
systemctl start jenkins
4.1、如果启动失败
![](https://i-blog.csdnimg.cn/blog_migrate/ec6b901f27083f18bb77b9d4157d56d1.png)
利用systemctl status jenkins.service 查看错误信息,如下:
![](https://i-blog.csdnimg.cn/blog_migrate/229c4626c94a2c5e1b20c68c0909a619.png)
原因是没有配置java地址到jenkins中
解决办法:
1、
[root@cc jenkins]# which java
/usr/local/java/jdk1.8.0_201/bin/java
2、
#添加到
vim /etc/rc.d/init.d/jenkins
candidates="
/usr/bin/java
/usr/local/java-1.8/jdk1.8.0_351/bin/java
"
:wq保存
3、执行systemctl daemon-reload 读取配置
4、重新启动:systemctl start jenkins
4.2、出现状态为exited
![](https://i-blog.csdnimg.cn/blog_migrate/fc5a69f02ea78253d96075cdc1130806.png)
解决办法:https://blog.csdn.net/twilight1999/article/details/124268463
5、关闭防火墙
systemctl stop firewalld
//查看防火墙状态命令
systemctl status firewalld
6、访问
http://服务器ip:8080/
注:后续如果使用admin登录,默认密码查询
admin账户:admin
默认密码查询(即初次进入Jenkins页面时让查询并填写的密码):
cat /var/lib/jenkins/secrets/initialAdminPassword
其他可能需要的命令
卸载:
systemctl stop jenkins
yum remove jenkins
rm -rf /etc/sysconfig/jenkins.rpmsave
rm -rf /var/cache/jenkins/
rm -rf /var/lib/jenkins/
rm -rf /var/log/jenkins
rm -rf /usr/lib/jenkins
重启:
systemctl restart jenkins
停止:
systemctl stop jenkins
修改jenkins的访问端口:
vim /etc/sysconfig/jenkins
然后修改内容如下:JENKINS_PORT="端口号"