1.添加yum源
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
2.导入密钥
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
3.安装jenkins
yum install jenkins
4.修改配置文件
vim /etc/sysconfig/jenkins
说明:修改JENKINS_PORT="20025"以及JENKINS_USER="root"
5.修改目录权限
chown -R root:root /var/lib/jenkins
chown -R root:root /var/cache/jenkins
chown -R root:root /var/log/jenkins
6.重启Jenkins服务
service jenkins restart