①添加官方的rpm包源,进行yum安装
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
sudo yum -y install jenkins
②编辑jenkins的/etc/init.d/jenkins程序文件,添加java路径
查看Linux中的java环境变量的绝对路径:# echo $JAVA_HOME
确认jenkins的程序文件中java路径正确:# sudo vim /etc/init.d/jenkins
③编辑jenkins的/etc/sysconfig/jenkins配置文件,修改端口、系统运行账户
编辑端口:vim /etc/sysconfig/jenkins
- 默认运行用户为jenkins
- 默认侦听端口为8080
④编辑/etc/profiles文件添加jenkins的环境变量
# sudo vim /etc/profile
export JENKINS_HOME=/var/lib/jenkins/
source /etc/profile
<