
正文
CentOS7 安装Jenkins
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
准备工作
首选需要安装JAVA环境
https://www.cnblogs.com/stulzq/p/9286878.html
如果你的系统没有自带git,那么也需要安装一个
yum install git
1.安装
第一种方法:
国内镜像下载jenkins包: https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/
第二种方法(未测试):
直接下载 rpm 安装
各个版本地址 https://pkg.jenkins.io/
# wget https://pkg.jenkins.io/redhat/jenkins-2.156-1.1.noarch.rpm
#
# rpm -ivh jenkins-2.156-1.1.noarch.rpm
2.配置
# vim /etc/sysconfig/jenkins
#
#监听端口
# JENKINS_PORT=""
3.配置权限
为了不因为权限出现各种问题,这里直接使用root
修改用户为root
# vim /etc/sysconfig/jenkins
#
#修改配置
# $JENKINS_USER="root"
修改目录权限
# chown -R root:root /var/lib/jenkins
# chown -R root:root /var/cache/jenkins
# chown -R root:root /var/log/jenkins
重启
# service jenkins restart
# ps -ef | grep jenkins
4.启动
# systemctl start jenkins
报错汇总:
1、Starting jenkins (via systemctl): Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
原因:找不到java安装路径
[root@PCS103 init.d]# vim /etc/init.d/jenkins

2、Starting jenkins (via systemctl): Warning: jenkins.service changed on disk. Run 'systemctl daemon-reload' to reload units.
[root@PCS103 init.d]# systemctl daemon-reload
3、输入jenkins地址,提示该jenkins实例似乎已离线
# 当Jenkins运行出现实例似乎已离线,执行以下操作
# vim /var/lib/jenkins/hudson.model.UpdateCenter.xml # 打开更新模块数据文件 https://updates.jenkins.io/update-center.json 改成 http://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json # 重启Jenkins
# service jenkins restart
4、jenkins设置中文
https://www.cnblogs.com/qianjinyan/p/10769981.html
5、批量删除构建历史:
https://blog.csdn.net/babylovewei/article/details/90080761







