1 下载
环境准备:
版本支持查询:https://pkg.jenkins.io/redhat-stable/
安装JDK17:https://blog.csdn.net/qq_44870331/article/details/140784297
yum -y install epel-release wget upgrade
wget -O /etc/yum.repos.d/jenkins.repo \
https://pkg.jenkins.io/redhat/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat/jenkins.io-2023.key
这个下载太慢了,还是下面收到下包安装好
yum -y install jenkins
从清华源下载:https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat
wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat/jenkins-2.485-1.1.noarch.rpm --no-check-certificate
2 安装
rpm -ivh jenkins-2.485-1.1.noarch.rpm
3 查看安装的文件
rpm -ql jenkins
4 修改默认端口
vi /usr/lib/systemd/system/jenkins.service
4.1 改启动用户
4.2 改启动端口
JENKINS_PORT="16060"
4.3 修改JDK位置:
Environment="JAVA_HOME=/opt/coisini/jdk-17.0.12"
5 赋权
chown -R root:root /var/lib/jenkins
6 创建快链接:
ln -s /usr/lib/systemd/system/jenkins.service /etc/systemd/system/jenkins.service
chmod 754 /etc/systemd/system/jenkins.service
7 重新加载配置
systemctl daemon-reload
8 相关命令
设置开机自启:systemctl enable jenkins
启动:systemctl start jenkins
状态:systemctl status jenkins
9 开放端口:
firewall-cmd --zone=public --add-port=16060/tcp --permanent
firewall-cmd --reload
10 浏览器访问:
http://192.168..:16060/
11 需要输入管理密码, 在以下位置查看:
cat /var/lib/jenkins/secrets/initialAdminPassword
12 个性化安装
按默认设置,把建议的插件都安装上:
要等几分钟……有几个安装错误,后面点重试,就能装上了