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
Jenkins 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.
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.repo
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 jenkins
Configure the firewall to allow access for the Jenkins portal from external machines.
firewall-cmd --permanent --add-port=8080/tcp firewall-cmd --reload
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.
For 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.
Copy and paste the password on Jenkins setup wizard, and then click on Continue.
Either 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.
Wait for the plugins to install.
Create the first admin user for Jenkins.
Set up the root URL for Jenkins.
Jenkins is now complete. You can start working on Jenkins by clicking on Start using Jenkins.
To access Jenkins, go to the below URL using the browser.
Log in with Jenkins’s admin account you created a few steps back.
Upon successful login, you will get the Jenkins dashboard.
That’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.