At first we need to install java 8
sudo yum install java-1.8.0-openjdk-devel
sudo yum -y update
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 -y install jenkins
sudo systemctl daemon-reload
sudo systemctl start jenkins
sudo systemctl status jenkins
Output ● jenkins.service - LSB: Start Jenkins at boot time Loaded: loaded (/etc/init.d/jenkins; generated) Active: active (exited) since Mon 2018-07-09 17:22:08 UTC; 6min ago Docs: man:systemd-sysv-generator(8) Tasks: 0 (limit: 1153) CGroup: /system.slice/jenkins.service
By default, Jenkins listens on port TCP 8080. Open this port on the instance firewall by configuring the firewall.
sudo firewall-cmd --zone=public --permanent --add-port=8080/tcp sudo firewall-cmd --reload
- Now Jenkins is configured on the instance. This instance acts as the Jenkins master node. To access this node from the outside internet, open the TCP port 8080 on the security list for the subnet which houses the Jenkins master instance.
Step 2 – Configuring Jenkins Master
- On the web browser, access Jenkins dashboard using the public IP of the instance and port 8080. You will see the Unlock Jenkins screen, which displays the location of the initial password.
- In the terminal window, use the cat command to display the password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
- Copy the 32-character alphanumeric password from the terminal and paste it into the Administrator password field, then click Continue. The next screen presents the option of installing suggested plugins or selecting specific plugins.
- Go ahead and install the suggested plugins.
- When the installation is complete, you are prompted to set up the first administrative user. You can skip this step and continue as an admin using the initial password used in the previous step. Here, we proceed as admin. You should see a Jenkins is ready! confirmation screen. Click Start using Jenkins to visit the main Jenkins dashboard. At this point, basic configuration of Jenkins master has been successfully completed.