1. 系统:
2. JAVA安装
3. 安装jenkins
官网下载jenkis的rmp包,官网地址(http://pkg.jenkins-ci.org/redhat-stable/)——我使用了这个方法
wget http://pkg.jenkins-ci.org/redhat-stable/jenkins-2.7.3-1.1.noarch.rpm
rpm -ivh jenkins-2.7.3-1.1.noarch.rpm
网上其他推荐 添加Jenkins库到yum库,Jenkins将从这里下载安装
wget-O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
yuminstall-y jenkins
配置jenkins的端口(默认端口8080,如果不冲突可以不修改,netstat -ntlp查看已经占用的端口)
vi /etc/sysconfig/jenkins
4. 启动jenkins服务
service jenkins start/stop/restart
服务启动失败:Restarting 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.
解决办法:vi /etc/sysconfig/jenkins 修改JENKINS_USER="jenkins" 修改为JENKINS_USER="root"
再启动服务service jenkins start失败
Starting jenkins (via systemctl): Warning: jenkins.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
解决办法:vi /etc/rc.d/init.d/jenkins 增加java路径(路径查看:which java)
再次启动服务,ok
5. WEB访问,http://IP:端口号
出现无法访问此网站,检查代理服务器和防火墙
解决办法: 关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
6. 访问成功后输入密码,根据提示地址查看,输入后可登录成功