一,jenkins安装

# 先安装java环境
yum install java-1.8.0-openjdk* -y

#  从清华源镜像站下载jenkins包
wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/jenkins-2.249.1-1.1.noarch.rpm

# 安装jenkins包
yum -y localinstall jenkins-2.249.1-1.1.noarch.rpm

# 启动jenkins
systemctl start jenkins

# 启动之后访问下jenkins默认8080端口
http://10.0.0.100:8080/login?from=%2F

# 查看密码
cat /var/lib/jenkins/secrets/initialAdminPassword

# 点击跳过插件管理
# 根据提示注册账号密码

二,jenkins插件管理

# 进入到jenkins配置文件目录
cd /var/lib/jenkins/updates

# 更换插件下载源(先搜索下有没有替换的源)
sed -i 's#https:\/\/updates.jenkins.io\/download#https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins#g' default.json
sed -i 's#http:\/\/www.google.com#https:\/\/www.baidu.com#g' default.json


# 最后进入jenkins网站里面,插件管理点击高级,把站点升级改为国内插件下载地址
https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json

# 进入到插件目录上传插件
[root@shell /var/lib/jenkins/plugins]# rz plugins.tar.gz

# 解压jenkins
[root@shell /var/lib/jenkins/plugins]# tar xf plugins.tar.gz

# 重启jenkins
systemctl restart jenkins