其实jenkins官网就有教程,大多时候我比较排斥官网的英文描述,长时间下来发现自己走了不少弯路,官网的操作手册或者理念都是最正宗的:https://jenkins.io/download/
这里我以官网描述总结:
1. To use this repository, run the following command:
Operation:
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
2. If you've previously imported the key from Jenkins, the "rpm --import" will fail because you already have a key. Please ignore that and move on.
You will need to explicitly install a Java runtime environment, because Oracle's Java RPMs are incorrect and fail to register as providing a java dependency. Thus, adding an explicit dependency requirement on Java would force installation of the OpenJDK JVM.
Operation:
yum install jenkins
3. 修改Jenkins启动配置文件,指定java安装路径:vim /etc/init.d/jenkins
在candidates中第一行添加java路径,如下:
4.修改防火墙允许8080端口访问:vim /etc/sysconfig/iptables 加入:-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT 重启防火墙:sudo service iptables restart
5.在浏览器中访问,
初始密码在:/var/lib/jenkins/secrets/initialAdminPassword
6.地址栏输入:http://ip/port 不要带jenkins,会报404错。