Linux Installing Jenkins Steps and Solving Various Problems of Page Access Initialization Password

  • 2021-07-10 21:32:33
  • OfStack

1. Prepare the java environment, jdk 1.8

Check whether java is installed. If not, install java environment: java-version first

2. Install Jenkins

Official website: https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Red+Hat+distributions # InstallingJenkinson

(1) Install Stable Version


sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
sudo yum install jenkins

(2) Install the latest version


sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
sudo yum install jenkins

(3) Select a version and wait for the installation to be completed

3. Configure Jenkins

Description: Default installation directory

(1)/usr/lib/jenkins/: The jenkins installation directory, where the WAR package will be placed.
(2) /etc/sysconfig/jenkins: jenkins configuration file, "port", "JENKINS_HOME" and so on can be configured here.
(3) /var/lib/jenkins/: The default JENKINS_HOME.
(4)/var/log/jenkins/jenkins. log: Jenkins log file.

(1) Modify the default port number

Edit file: vim/etc/sysconfig/jenkins

Find JENKINS_PORT and change the default port number (8080). I change it to 8081 here

(2) Modify jdk configuration

Edit file: vim/etc/init. d/jenkins

Find the java path where candidates adds its own jdk in line 1

Note: linux View jdk Installation Path Command-which java

(3) Modify firewall configuration: Choose one method to execute

(1) Open Port 8081 and restart the firewall:
Open port 8081: firewall-cmd-zone=public-add-port=8081/tcp-permanent
Restart firewall: firewall-cmd-reload

(2) Close the firewall: systemctl stop firewalld

4. Jenkins Start/Restart/Stop Command

linux command line:

(1) Startup: service jenkins start
(2) Restart: service jenkins restart
(3) Stop: service jenkins stop

Browser Enters Jenkins

(1) Login: http://Own IP: 8081/
(2) Turn off: http://Own IP: 8081/exit
(3) Restart: http://Own IP: 8081/restart
(4) Reload: http://Own IP: 8081/reload

5. Browser login to Jenkins

(1) Unlock Jenkins:

Enter the command: cat /var/lib/jenkins/secrets/initialAdminPassword

Copy the administrator password to the page entry box: 92aa3b378394496fb9cd7f0c300

6. Install plug-ins according to your needs

Summarize


Related articles: