1、下载
注意:至少安装2.319的版本,否则插件安装失败,2.357 之后版本需要java11,请注意java版本
a、开始下载,利用华为云地址 https://mirrors.huaweicloud.com/home,速度杠杠快
搜索jenkins,点击jenkins,选择继续使用(免登录)
b、选择版本
利用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,不安装会报错
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、如果启动失败
利用systemctl status jenkins.service 查看错误信息,如下:
原因是没有配置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://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="端口号"