Jenkins is an open source continuous integration tool written in java and is currently widely used by companies at home and abroad. This chapter teaches you how to install Jenkins on a Linux server.
Get a linux server
To install git under linux, you must first have a linux server, here I choose Tencent Cloud
Install jdk
Jenkins depends on jdk to run, so we have to install jdk before installing Jenkins. Students who have no installation experience can refer to my other tutorial on installing jdk on a linux server. Portal: install jdk on the linux server
yum install Jenkins
It is recommended to use yum to install Jenkins, which is the easiest and most convenient.
There is no Jenkins in yum repos by default. You need to add the Jenkins repository to yum repos first.
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 starts to download and install automatically.
When prompted whether to download, enter y and press Enter.
Wait patiently for the installation to complete.
Now Jenkins has been installed, but it is best to modify the configuration slightly before starting. The default is that Jenkins is started by the Jenkins user, but this user is currently not granted permission 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 also modify the default port.
Enter the command to enter the Jenkins configuration file
vi /etc/sysconfig/jenkins
Easy to find in the configuration file
Modify the configuration here
JENKINS_USER="root"
JENKINS_PORT="8081"
After modifying the configuration, save and exit.
Ok, now the configuration file is also modified, and you can start Jenkins.
Enter the start command to start the Jenkins service.
service jenkins start
If OK appears, it means that Jenkins started successfully.
Enter ip:8081 in the browser to enter the Jenkins login page.
Jenkins login for the first time
After entering the login page, Jenkins prompts us to enter the super administrator password to unlock it. According to the prompt, we can find the password in the /var/lib/jenkins/secrets/initialAdminPassword file.
Enter the command to find the password.
tail /var/lib/jenkins/secrets/initialAdminPassword
Find the unlock code
After finding the password, copy the password, paste it to the Jenkins unlock page, and click Continue to continue the initialization configuration. After a short wait, enter the plug-in installation page.
Jenkins plugin installation
Here we click Install suggested plugins to install the default plugins. Of course, you can also click another button to install the specified plugins.
After clicking, the page enters the plug-in download and installation page.
Default plugin installation
Wait patiently for all installations to be completed. After the installation is complete, the page automatically enters the administrator account registration page.
Administrator account registration
Everyone is no stranger to this page. Enter your information and register. After entering the information, click Save and Finish.
Jenkins installation is complete
Click Start using Jenkins to enter the main Jenkins page.
Jenkins
At this point, Jenkins is installed and initialized.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。