How To Install Jenkins on CentOS 8 / RHEL 8 & CentOS 7 / RHEL 7
Abstract: How To Install Oracle Java on CentOS 8 / RHEL 8 Once the installation is completeHow To install Oracle Java on CentOS 7 / RHEL 7 READ
Jenkins is an open-source CI (continuous integration) tool written in Java that helps to automate the repetitive tasks like software build, testing, and deployments involved in the software development process
Jenkins project was originally developed as the Hudson project and was renamed after a dispute with Oracle.
Here, we will see how to install Jenkins on CentOS 8 / RHEL 8 & CentOS 7 / RHEL 7.
THIS DOCUMENT IS ALSO AVAILABLE FOR Debian 10 Debian 9 Ubuntu 18.04 Ubuntu 16.04 Prerequisites Install JavaJenkins requires Java JRE 8 or Java JRE 11. Here, I will install OpenJDK 8.
yum -y install java-1.8.0-openjdk wget
In case you want to use the Oracle Java instead of OpenJDK, follow the below link to install it.
READ: How To install Oracle Java on CentOS 7 / RHEL 7
READ: How To Install Oracle Java on CentOS 8 / RHEL 8
Once the installation is complete, verify the Java version.
java -version
Output:
openjdk version "1.8.0_212" OpenJDK Runtime Environment (build 1.8.0_212-b04) OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)Add Jenkins repository
Jenkins is not available on the OS repository. So, we will add Jenkin’s official repository on the system for Jenkins installation.
Add the Jenkins key to the system.
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
Add the Jenkins repository to your system.
cd /etc/yum.repos.d/ curl -O https://pkg.jenkins.io/redhat-stable/jenkins.repoInstall Jenkins
Now, install Jenkins using the following command.
yum -y install jenkins
Start Jenkins service.
systemctl start jenkins
Enable auto-start of Jenkins service on system boot.
systemctl enable jenkins
Check the status of Jenkins service.
systemctl status jenkinsInstall Jenkins on RHEL 8 – Jenkins Service Status Firewall
Configure the firewall to allow access for the Jenkins portal from external machines.
firewall-cmd --permanent --add-port=8080/tcp firewall-cmd --reloadSetup Jenkins
With Jenkins’s web interface, we can build, test, and deploy software. Before accessing the Jenkins web interface, we need to set up it.
Open up a web browser and go to the following URL.
http://your.ip.add.ress:8080For security reasons, Jenkins puts up the initial password in /var/lib/Jenkins/secrets/initialAdminPassword
file to prevent an unauthorized Jenkins installation.
Read the file with the below command and get the password for Jenkins installation.
cat /var/lib/jenkins/secrets/initialAdminPassword
Output:
18b628b7df874031932d2400e3b9d050Initial Jenkins Admin Password
Copy and paste the password on Jenkins setup wizard, and then click on Continue.
Install Jenkins on RHEL 8 – Unlock JenkinsEither install suggested plugins or select plugins to install based on your needs. I recommend you to install suggested plugins to install most useful plugins for now, and of course, you can install required plugins later.
Install Jenkins on RHEL 8 – Customize JenkinsWait for the plugins to install.
Install Jenkins on RHEL 8 – Jenkins Plugin InstallationCreate the first admin user for Jenkins.
Install Jenkins on RHEL 8 – Create Admin UserSet up the root URL for Jenkins.
Install Jenkins on RHEL 8 – Instance ConfigurationJenkins is now complete. You can start working on Jenkins by clicking on Start using Jenkins.
Install Jenkins on RHEL 8 – Jenkins Setup Complete Access JenkinsTo access Jenkins, go to the below URL using the browser.
http://your.ip.add.ress:8080Log in with Jenkins’s admin account you created a few steps back.
Upon successful login, you will get the Jenkins dashboard.
Jenkins Dashboard ConclusionThat’s All. You have learned how to install Jenkins on CentOS 8 / RHEL 8 & CentOS 7 / RHEL 7. Additionally, see how to create your first Jenkins project. Also, read Jenkins’s documentation for more information. Please share your feedback in the comments section.