CentOS 7 Detailed explanation of Jenkins installation process
- 2021-07-03 01:02:49
- OfStack
Installing Jenkins through Yum
Step 1 Install
# yum Source import
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
# Import key
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
# Installation
yum install -y jenkins
2. Open the port
# Ports can be found in the /etc/sysconfig/jenkins Modified in the file, the default is 8080
firewall-cmd --add-port=8080/tcp --permanent
firewall-cmd --reload
3. Configure the Java path
# Modify jenkins Startup script
vim /etc/init.d/jenkins
# Modify candidates Increase java Optional path: /usr/java/jdk1.8.0_181/bin/java
candidates="
/etc/alternatives/java
/usr/lib/jvm/java-1.8.0/bin/java
/usr/lib/jvm/jre-1.8.0/bin/java
/usr/lib/jvm/java-1.7.0/bin/java
/usr/lib/jvm/jre-1.7.0/bin/java
/usr/bin/java
/usr/java/jdk1.8.0_181/bin/java
"
4. Start Jenkins and set up boot
# Overloaded service (due to the previous modification Jenkins Startup script)
systemctl daemon-reload
# Start Jenkins Services
systemctl start jenkins
# Will Jenkins The service is set to boot
# Due to Jenkins No Native Service , so you need to use chkconfig Orders instead of systemctl Command
/sbin/chkconfig jenkins on
5. Jenkins initialization
Use
cat /var/lib/jenkins/secrets/initialAdminPassword
Check the password, enter it in Jenkins management page to unlock it, and then you can visualize it!
The first boot may encounter page 1 showing "Please wait while Jenkins is getting ready to work...", edit
/var/lib/jenkins/hudson.model.UpdateCenter.xml
Document, amend "https://updates. jenkins. io/update-center. json" to "http://mirror.xmission.com/jenkins/updates/update-center.json".
6. Others
6.1 Set the time zone of Jenkins to Beijing time
Open System Administration- > "Script Command Line" runs the following command
System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone', 'Asia/Shanghai')