打开jenkins镜像包官网,找到自己想要安装的版本,官网地址:https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable
下载指定版本安装包:
wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/jenkins-2.452.2-1.1.noarch.rpm
安装jdk
配置jdk步骤:centos配置jdk(第28章节)
查看Java版本
java -version
安装jenkins
rpm -ivh jenkins-2.452.2-1.1.noarch.rpm
给jenkins配置jdk
vim /lib/systemd/system/jenkins.service
添加如下内容
Environment="JAVA_HOME=/usr/local/jdk11"
启动jenkins
systemctl start jenkins
# 记得关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
# 查看jenkins状态
systemctl status jenkins
# 重启jenkins命令
systemctl daemon-reload
systemctl restart jenkins.service
使用IP:端口号
访问jenkins即可,端口默认8080
查看密码
cat /var/lib/jenkins/secrets/initialAdminPassword
后续就是下一步即可。
浏览器查看启动日志:http://192.168.119.130:8080/log/all