一、试了用容器部署,不行。(建议别用容器部署)
二、直接部署在主机上
1、安装java环境
yum install java-11-openjdk-devel
# 检查
java -version
# 打印
[root@iZwz9a99mctbkabkh2imhdZ init.d] java -version
openjdk version "11.0.21" 2023-10-17 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.21.0.9-1.el7_9) (build 11.0.21+9-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.21.0.9-1.el7_9) (build 11.0.21+9-LTS, mixed mode, sharing)
2、安装jenkins
官网安装说明:https://pkg.jenkins.io/redhat-stable/
内容跟下面一样的
命令我给大家复制出来了,只需要执行这四条
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-2023.key
yum install fontconfig java-17-openjdk
yum install jenkins
3、配置jenkins
systemctl edit jenkins
添加如下内容
[Service]
Environment="JENKINS_PORT=7777"
7777为你的端口号
4、启动jenkins
systemctl start jenkins
5、打开网站
http://ip:7777
输入密码后点击继续
选择安装推荐的插件
安装完成后
设置好点击继续,后面的就很简单了
6、完成
右上角的警告和错误可以忽略的,没事