1. Environment preparation

1.1 Environment Description

  • 256MB of available memory
  • 1GB of available disk space (10GB recommended for Jenkins running as a Docker container)

Java 8 (either JRE or JDK)

No The host name The domain name role IP
1 jenkins jenkins.local.com Code compilation and deployment 192.168.8.183

2 Environment Installation

2.1 the hostname

$ hostnamectl set-hostname jenkins --static
Copy the code

2.2 Network Settings

$ vi /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO="static" # DHCP static instead
ONBOOT="yes" # Enable this configuration on startupIPADDR = 192.168.8.183# static IPGATEWAY = 192.168.8.2# default gatewayNETMASK = 255.255.255.0# Subnet maskDNS1 = 114.114.114.114# the DNS configurationDNS2 = 8.8.8.8# the DNS configuration

$ service network restart
Copy the code

2.3 hosts

$ echo "192.168.8.183 jenkins.local.com" >> /etc/hosts
$ reboot
Copy the code

The installation Java1.8

$ su -c "Yum - y install Java -- 1.8.0 comes with its devel -"

$ java -version
openjdk version "1.8.0 comes with _275"
OpenJDK Runtime Environment (build 1.8.0_275-b01)
OpenJDK 64-Bit Server VM (build 25.275-b01, mixed mode)
Copy the code

4 Install Jenkins 2.273

4.1 Importing a Repository installation

$ yum install wget
$ sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo
$ sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
$ yum -y install jenkins
Copy the code

4.2 Configuring Services

$ systemctl enable jenkins
Copy the code

4.3 Jenkins start and stop

$ systemctl start jenkins
$ systemctl stop jenkins
Copy the code

4.4 Enabling Port 8080 on the Firewall

$ firewall-cmd --zone=public --add-port=8080/tcp --permanent
$ firewall-cmd --reload
$ firewall-cmd --zone=public --list-ports
Copy the code

5 Begin the interview with Jenkins

Query the initial password as prompted

Installation time: 3-5 minutes……