1. The background
In the research and development, it is necessary to configure CI/CD environment, Jenkins is a very common continuous integration tool.
2. Install the Jenkins
2.1 Installation on centos
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.key sudo yum upgrade sudo yum install Jenkins Java -- 1.8.0 comes with its devel sudo systemctl daemon-reloadCopy the code
2.2 start
Now start Jenkins and execute:
sudo systemctl start jenkins
Copy the code
Checking startup Status
sudo systemctl status jenkins
Copy the code
Handling firewalls
YOURPORT=8080
PERM="--permanent"
SERV="$PERM --service=jenkins"
firewall-cmd $PERM --new-service=jenkins
firewall-cmd $SERV --set-short="Jenkins ports"
firewall-cmd $SERV --set-description="Jenkins port exceptions"
firewall-cmd $SERV --add-port=$YOURPORT/tcp
firewall-cmd $PERM --add-service=jenkins
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload
Copy the code
Note: This will only work if Jenkins users are authorized
chown -R jenkins:jenkins /var/lib/jenkins
chown -R jenkins:jenkins /var/cache/jenkins
chown -R jenkins:jenkins /var/log/jenkins
systemctl restart jenkins
Copy the code
2.2 Web Access
Visit http://localhost:8080
image.png
3. The configuration Jenkins
Viewing the Initial Password
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the code
After obtaining the initial password, you will find that it is very slow to load
Domestic network problems, we will modify the domestic update mirror update address
cd /var/lib/jenkins/
cat hudson.model.UpdateCenter.xml
cp hudson.model.UpdateCenter.xml hudson.model.UpdateCenter_bak.xml
vi hudson.model.UpdateCenter.xml
Copy the code
reference
- Website www.jenkins.io/doc/book/in…
- After start-up cannot access port blog.csdn.net/xiaoxiangzi…
- Modified into domestic update image update address www.cnblogs.com/shiyixirui/…
- Jenkins installation directory location www.cnblogs.com/zengjunhua/…
Appendix: Jenkins updates service address
http://mirror.xmission.com/jenkins/updates/update-center.json
http://updates.jenkins-ci.org/update-center.json
http://mirror.esuni.jp/jenkins/updates/update-center.json
Copy the code
Jenkins mirror query address: mirrors.jenkins-ci.org/status.html
Jenkins: blog.csdn.net/qq_38461773…