一、安装git
yum install git
二、安装Jenkins
1.命令安装
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 yum install jenkins
2.下载后安装
wget https://pkg.jenkins.io/redhat/jenkins-2.156-1.1.noarch.rpm rpm -ivh jenkins-2.156-1.1.noarch.rpm
三、配置权限、用户和端口
vim /etc/sysconfig/jenkins #配置端口 JENKINS_PORT="8080" #配置用户 $JENKINS_USER="root" # 修改权限 chown -R root:root /var/lib/jenkins chown -R root:root /var/cache/jenkins chown -R root:root /var/log/jenkins
四、重启
# 重启 service jenkins restart ps -ef | grep jenkins #启动 systemctl start jenkins
五、进入界面继续安装
1.输入密码
#执行命令查看密码 cat /var/lib/jenkins/secrets/initialAdminPassword
2.安装推荐插件
3.等待安装
4.创建管理员账号和密码
5.完成安装
六、卸载Jenkins
systemctl stop jenkins.service yum remove jenkins rm -rf /etc/sysconfig/jenkins.rpmsave rm -rf /var/cache/jenkins/ rm -rf /var/lib/jenkins/ rm -rf /var/log/jenkins rm -rf /usr/lib/jenkins