Jenkins依賴於Java,故安裝Jenkins也要安裝Java。
Jenkins和Java版本相依賴,版本衝突會導致Jenkins安裝、啟動失敗,
先到 Java Support Policy 確認自己想安裝的Jenkins版本和應該要安裝的Java版本
我想安裝最新的Jenkins,此時對應的是 java 11
sudo yum install fontconfig java-11-openjdk
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
sudo yum install -y jenkins
4.啟動Jenkins
sudo systemctl start jenkins.service
4.允許 Jenkins 服务自動啟動
sudo systemctl enable jenkins.service
5.允許訪問Jenkins服務,開啟防火牆
sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp
firewall-cmd --zone=public --add-service=http --permanent
sudo firewall-cmd --reload
6.查看Jenkins密碼
cat /var/lib/jenkins/secrets/initialAdminPassword