如需转载分享,请标明出处,且不用于盈利为目的,谢谢合作!
linux中安装Jenkins
一、安装jdk
https://blog.csdn.net/weixin_45353401/article/details/96287866
二、安装git
使用yum安装git
yum install git
三、安装Jenkins
1.执行命令安装
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
yum install jenkins
2.修改端口,默认8080
vi /etc/sysconfig/jenkins
JENKINS_PORT="8080"
3.修改权限配置,这里用户改为root,你也可以用别的
vi /etc/sysconfig/jenkins
$JENKINS_USER="root"
4.修改目录权限
chown -R root:root /var/lib/jenkins
chown -R root:root /var/cache/jenkins
chown -R root:root /var/log/jenkins
5.重启
service jenkins restart
ps -ef | grep jenkins
提示这个:Restarting jenkins (via systemctl): Warning: jenkins.service changed on disk. Run ‘systemctl daemon-reload’ to reload units
运行命令解决,然后重启:
systemctl daemon-reload
6.启动
systemctl start jenkins
7.查看Jenkins运行状态
systemctl status jenkins.service
8.访问Jenkins页面
http://192.168.17.140:8181
9.获得登录密码
/var/lib/jenkins/secrets/initialAdminPassword
10.安装插件,选择安装推荐插件
11.创建一个管理员账户
这边自己定义用户信息,然后保存并继续
12.实例配置
我选的是默认的,然后保存并继续
13.安装完成,开始使用Jenkins
14.输入用户名和密码,页面空白无显示,修改hudson.model.UpdateCenter.xml
文件,然后重启
vi /var/lib/jenkins/hudson.model.UpdateCenter.xml
将<url>https://updates.jenkins.io/update-center.json</url>
替换成<url>http://mirror.xmission.com/jenkins/updates/update-center.json</url>
重启Jenkins
service jenkins restart
15.运行成功页面