Pay attention to JDK installation and Jenkins installation!!

First, install Java

Do not install with yum! Do not install with yum! Do not install with yum!

Download the JDK package jdK-8U291-linux-x64.tar. gz from the official website, decompress it to a customized directory, such as /usr/local/java/, and configure /etc/profile

vi /etc/profile
Copy the code

Add at the end:

Export JAVA_HOME=/usr/local/ Java /jdk1.8.0_291 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH source /etc/profileCopy the code

Check the Java version and output the version information

java -version
echo $JAVA_HOME
Copy the code

2. Install Jenkins

Method 1 Recommendation

According to the official website

www.jenkins.io/doc/book/in…

Note that if you have a Java environment installed, remove the section where the JDK is installed

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
sudo yum upgrade
sudo yum install jenkins
sudo systemctl daemon-reload
Copy the code

Start Jenkins

You can start the Jenkins service with the command:

sudo systemctl start jenkins
Copy the code

You can check the status of the Jenkins service using the command:

sudo systemctl status jenkins
Copy the code

Method two no suggestion No suggestion no suggestion! If the plug-in cannot be installed after installation, go to step 3

Wget http://pkg.jenkins-ci.org/redhat-stable/jenkins-2.7.3-1.1.noarch.rpm RPM -ivh jenkins-2.3.3-1.1.noarch.rpmCopy the code

Modify Jenkins configuration file and add JDK path

vi /etc/init.d/jenkins
Copy the code

Start the Jenkins

service jenkins start
Copy the code

Third, interview Jenkins

(I) Problems encountered: no access

Solutions:

1. Check the firewall status.

systemctl status firewalld
Copy the code

Then look at the list of ports

firewall-cmd --list-ports
Copy the code

Add port 8080

firewall-cmd --permanent --zone=public --add-port=8080/tcp
Copy the code

Restart the firewall:

systemctl reload firewalld
Copy the code

(II) For normal access, the following process shall be carried out:

1. Access IP address: port number

cd /var/lib/jenkins/secrets/
cat initialAdminPassword
Copy the code

2. Enter the key

3. Select the recommended plug-in by default and go to the next step

4. If the installation fails, you can install the plug-in later

5. Enter the account password and the next default address to enter the home page