1、首先安装好Java
yum install -y java
java -version
![](https://img2018.cnblogs.com/blog/1426499/201809/1426499-20180926155752597-1887868097.png)
2. 获取jenkins安装源文件
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
3. 导入公钥 (如果报错,多执行几次就好了)
yum -y update nss
rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
4. 安装Jenkins
yum install -y jenkins
5. 配置文件修改( 修改默认端口为8787)
vim /etc/sysconfig/jenkins
![](https://img2018.cnblogs.com/blog/1426499/201809/1426499-20180926161232702-794238002.png)
6.启动
service jenkins start
报错解决
![](https://img2018.cnblogs.com/blog/1426499/201811/1426499-20181105095741858-1373547888.png)
yum -y install java-1.8.0-openjdk.x86_64
7.访问安装 http://{IP地址}:8787
8、加入开机自启动
systemctl enable jenkins.service