wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/jenkins-2.204.3-1.1.noarch.rpm
rpm -ivh jenkins-2.204.3-1.1.noarch.rpm
配置jenkins端口与jdk
vim /etc/sysconfig/jenkins
JENKINS_PORT="5500" #<<-要修改的内容
vim /etc/init.d/jenkins
candidates="
/etc/alternatives/java
/usr/lib/jvm/java-1.8.0/bin/java
/usr/lib/jvm/jre-1.8.0/bin/java
/usr/lib/jvm/java-1.7.0/bin/java
/usr/lib/jvm/jre-1.7.0/bin/java
/usr/lib/jvm/java-11.0/bin/java
/usr/lib/jvm/jre-11.0/bin/java
/usr/lib/jvm/java-11-openjdk-amd64
/usr/bin/java
/usr/java/jdk1.8.0_231/bin/java ##《--要增加的一行,你的jdk安装位置
"
systemctl daemon-reload
systemctl start jenkins.service
systemctl status jenkins.service
/sbin/chkconfig jenkins on
启动后访问 http://IP:端口
通过控制台的提示来初始化jenkins,会要求输入输入初始秘钥(cat /var/lib/jenkins/secrets/initialAdminPassword 查看秘钥),更改密码,安装推荐的插件,默认流程即可,插件安装失败跳过即可。
修改jenkins插件原地址
【系统管理】【管理插件】【高级】Update Site 修改为 https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
点击--》Manage Jenkins (管理jenkins) --》 pluginManager (插件管理) --> Avaiable (可以安装的) --》查找docker-build-step插件 --》 Install without restart
如果更换安装源后仍然不生效,修改文件,重启jenkins
[root@zb-192-168-1-139 ~]# cp /var/lib/jenkins/updates/default.json /var/lib/jenkins/updates/default.json.bak
[root@zb-192-168-1-139 ~]# sed -i 's/http:\/\/updates.jenkins-ci.org\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' /var/lib/jenkins/updates/default.json
[root@zb-192-168-1-139 ~]# systemctl restart jenkins.service
再次安装查看结果:
安装的插件包括 Git docker-build-step