2# 1. Step list:
1. Install JDK
2. Install Jenkins
3. Modify Jenkins configuration
4. Start Jenkins
5. Open the server port and open the browser
6. Get the administrator password
7. Customize Jenkins
8. Create the first Admin user
2.Specific operations
1. Install JDK
method one:
a、命令直接下载:`yum install java-1.8.0-openjdk* -y`
Method two:
a. Download package: official website JDK1.8 package (note that Jenkins only supports JDK8-11 version)
b. Put the JDK1.8 package into the folder you want to put it in (I use sftp to drag it directly into the server folder) c
. Open the terminal In this folder, decompress the JDK1.8 package: tar -zxvf jdk-8u333-linux-aarch64.tar.gz
d. Open the configuration file and configure the environment variables:
(1) Open the file: vim/etc/profiles
(2) Modify the file: i enters editing, esc enters the exit step, ":wq" exits saving, " :q" to exit without saving:
JAVA_HOME=/usr/local/java/jdk8
PATH=$JAVA_HOME/bin:$PATH:${
MAVEN_HOME}/bin:$PATH
CLASSPATH=$JAVA_HOME/lib:$CLASSPATH
export PATH JAVA_HOME CLASSPATH MAVEN_HOME
(3) Update environment variables: Source /etc/profile
(4) Check whether the installation is successful:java -version
2. Install Jenkins
1. Download
a. Command to switch to your own download directory
(1) Download directly with the command:
wget http://pkg.jenkins-ci.org/redhat-stable/jenkins-2.190.3-1.1.noarch.rpm
(2) Install directly:
rpm -ivh jenkins-2.190.3-1.1.noarch.rpm
3. Modify Jenkins configuration
a. Find the configuration file location
Path: /etc/sysconfig/jenkins
(your location may be different, find it yourself)
b. Open the configuration file and modify the configuration
vim /etc/sysconfig/jenkins
Modify the port as follows:
JENKINS_PORT="8888"
(Note: It is consistent with the port opened by your server)
4. Start Jenkins
Start command: systemctl start jenkins
Start successfully as shown in the figure
Problems encountered:
Question one:
Reason: jdk does not meet the requirements of the current system Jenkins and requires jdk8-11 version. Solution: Reinstall the appropriate version of jdk.
Question two:
If the following error occurs (it must be that method 2 is used to install JDK)
Job for jenkins.service failed because the control process exited with error code. See “systemctl status jenkins.service” and “journalctl -xe” for details.
Cause: Jdk path error
Solution: Open the file vim /etc/init.d/jenkins
Configure the JDK path in Jenkins
After configuration, execute the following commands in sequence Command
to reload the configuration file: systemctl daemon-reload
Command to start Jenkins: systemctl start jenkins
Command to view the status of the Jenkins service: systemctl status jenkins.service
As shown in the figure: indicates success
5. Open the server port and open the browser for access
CentoS7-8
(1) Turn on the firewall: systemctl start firewalld
(2) Open the specified port:
firewall-cmd --zone=public --add-port=8888/tcp --permanent
Command meaning:
–zone #scope
–add-port=8888/tcp #Add port, the format is: port/communication protocol
–permanent #Permanent, no This parameter becomes invalid after restarting
(3) Restart the firewall: firewall-cmd --reload
(4) View the port number: netstat -ntlp
//View all current TCP ports·
Access: http://Server IP:8888, as shown in the figure, indicating success
6. Obtain the administrator password
Enter the command in the server terminal: (the path is the path in the picture above)
cat /var/lib/jenkins/secrets/initialAdminPassword
7. Customize Jenkins
It is recommended here to click "Select plug-ins to install"
and then uncheck all the checked plug-ins on the next interface.
Because Jenkins connects to the official website by default, the speed is very slow, and the process will fail, so skip the plug-in installation first (depending on your own situation)
8. Create the first administrator user
(1) Create a user according to the prompts (no big problem)
(2) Instance configuration (the default is fine)
(3) Seeing that Jenkins is ready means there is no problem. Click to start using it and wait for a while.
Note: This article was installed through my own practice, with the help of operation and maintenance colleagues. For most installations, please refer to the article "Super Detailed Full Process of Installing Jenkins on Linux"