安装
注意,一定要安装最新版的jenkins,不然后续会有很多插件的依赖关系不好解决,插件无法安装
- https://repo.huaweicloud.com/jenkins/redhat-stable/ 在这里选择最新版本的jenkins
https://repo.huaweicloud.com/jenkins/redhat-stable/jenkins-2.361.1-1.1.noarch.rpm
[root@k8s-master ~]# yum install -y /root/jenkins-2.361.1-1.1.noarch.rpm
# 选择jdk11(如果没有,可以先yum安装)
alternatives --config java
[root@k8s-master ~]# java --version
openjdk 11.0.16.1 2022-08-12 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.16.1.1-1.el7_9) (build 11.0.16.1+1-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.16.1.1-1.el7_9) (build 11.0.16.1+1-LTS, mixed mode, sharing)
[root@k8s-master ~]# systemctl start jenkins
[root@k8s-master ~]# systemctl status jenkins
[root@k8s-master ~]# systemctl enable jenkins
查看密码
[root@k8s-master ~]# cat /var/lib/jenkins/secrets/initialAdminPassword
b3a88b46928f41a6b890ae94d6d522b6
- 浏览器访问:192.168.47.100:8080
- root 123456
配置
-
配置jdk
-
Manage Jenkins --> Global Tool Configuration --> JDK
-
-
配置maven
-
Manage Jenkins --> Global Tool Configuration --> Maven 配置
-
-
配置ssh
-
在安装jenkins的主机上 [root@k8s-master ~]# ssh-keygen [root@k8s-master ~]# cd .ssh/ [root@k8s-master .ssh]# ls id_rsa id_rsa.pub [root@k8s-master .ssh]# cat id_rsa # 私钥复制,粘贴到jenkins上 #公钥传给需要免密的主机 [root@k8s-master .ssh]# ssh-copy-id k8s-master
-
Manage Jenkins --> Configure System --> Publish over SSH
-
-
配置gitlab证书
-
Manage Jenkins --> Security --> Manage Credentials --> System --> Global credentials --> Add Credentials
-
-
配置harbor证书
-
Manage Jenkins --> Security --> Manage Credentials --> System --> Global credentials --> Add Credentials
-