After a busy day, Master Zhou finally saw that Jenkins was installed successfully!
To install Jekins on a Linux system, you first need to install the JDK.
One. The method I use is yum to install jdk
1. After logging in to the system, enter
sudo yum -y list java*
Note: sudo executes commands as a system administrator.
2. We can see the various versions of jdk:
I am using java-11-openjdk-devel.x86_64
3. So enter the command:
sudo yum install -y java-11-openjdk-devel.x86_64
4. Wait for the installation to complete.
5. After the installation is complete, you can view the downloaded jdk.
cd /usr/lib/jvm
ls
2. Use yum to install jenkins
1. Need to add the jenkins repository to yum repos:
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
Wait for it to load to 100%
2. Use yum to install jenkins
sudo yum install jenkins
3. There will be a prompt whether to download, enter
y
4. Wait for the installation to complete.
5. Enter the configuration file,
sudo vi /etc/sysconfig/jenkins
6. To modify the configuration file, you need to press the " i " on the keyboard, and the word INSERT will appear , so you can modify it. Move the cursor to the place that needs to be modified
7. Modify the content as follows: the following two lines
JENKINS_USER="jenkins"
JENKINS_PORT="8080"
change into
JENKINS_USER="root"
JENKINS_PORT="8081"
8. After the modification is completed, press Esc on the keyboard and enter : wq (Note: there is a colon) to save.
9. Start jenkins
sudo service jenkins start
Seeing OK means that the installation is successful!
10. You also need to turn off the firewall before using the external network to log in
Check firewall: active (running) means it is on
sudo systemctl status firewalld
Turn off the firewall
sudo systemctl stop firewalld
11. Enter IP: 8081 in the browser, and you can log in to Jenkins.
12. After entering the page, you will be asked to enter the password: execute the following command, you can find the password!
tail /var/lib/jenkins/secrets/initialAdminPassword
13. After the configuration, you can successfully log in!