Jenkins is an open source continuous integration tool written in Java, which is widely used by companies at home and abroad. This chapter shows you how to install Jenkins on a Linux server.

Get a Linux server

To install Git on Linux, you first need to have a Linux server, and here I chose Tencent Cloud

Install the JDK

Jenkins relies on the JDK to run, so we need to install the JDK before we can install Jenkins. For those of you who are not experienced installing the JDK, please refer to my tutorial on installing the JDK on a Linux server. Portal: Install the JDK on the Linux server

Yum install Jenkins

It is recommended that you install Jenkins in the YUM mode, which is the easiest and most convenient way.

By default, there is no Jenkins in yum repos. You 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

Yum install Jenkins

yum install jenkins

Then you can see the system start downloading and installing automatically. When prompted to download or not, type Y and press Enter. Patiently wait for the installation to complete.

Jenkins is now installed, but it’s a good idea to modify the configuration slightly before starting. By default, Jenkins is started with the Jenkins user, but this user is not currently authorized by the system. Here we will change the startup user to root; In addition, the default port of Jenkins is 8080, which conflicts with the default port of Tomcat. We will also change the default port. Enter the command to enter the Jenkins configuration file

vi /etc/sysconfig/jenkins

It’s easy to find in the configuration file

Change the configuration here

JENKINS_USER="root"
JENKINS_PORT="8081"

After modifying the configuration, save and exit. Okay, now that the configuration file has been modified, it’s time to start Jenkins. Enter the start command to start the Jenkins service.

service jenkins start

An OK indicates Jenkins started successfully. Enter IP :8081 in your browser to enter the Jenkins login page.

After entering the login page for the first time, Jenkins prompts us to enter the super administrator password to unlock. According to the prompt, we can in the/var/lib/Jenkins/secrets/initialAdminPassword find password file.

Type the command to find the password.

tail /var/lib/jenkins/secrets/initialAdminPassword

Once you have found the password, copy it and paste it into the Jenkins unlock page. Click Continue to initialize the configuration. After a short wait, you enter the plug-in installation page.

Here we click Install Suggested Plugins to Install the default plugins, but you can also click the other button to Install the specified plugins.

After clicking, the page enters the plug-in download and installation page.

The default plug-in installation waits patiently for the entire installation to complete. After the installation is complete, the page is automatically entered into the administrator account registration page.

Administrator account registration this page we are certainly not unfamiliar, their input information to register it. Click Save and Finish when you have entered the information.

Click Start Using Jenkins to enter the Jenkins home page.

Jenkins

At this point, Jenkins is ready to install and initialize,