On this article we will discuss how to install Jenkins on CentOS 8 Linux operating system. Jenkins installation on Ubuntu 20.04 LTS opearting system has been discussed on this article.
Jenkins is free and the most popular open-source for automation server. It is used to automate the parts of software development related to building, testing, and deploying, facilitating continuous integration and continuous delivery (CI/CD) pipeline. On this tutorial we will use the last stable version of Jenkins which was reaseld on July 2, 2020. On this articel we will install Jenkins on CentOS 8 operating system.
Jenkins Installation On CentOS 8
The Jenkins installation will be consisting of several steps, namely :
- Installing Jenkins
- Enabling Firewall for Jenkins
- Setting Up Jenkins
There are several prerequisites to be fulfilled if we want to install Jenkins.
Minimum hardware requirements:
256 MB of RAM
1 GB of drive space (although 10 GB is a recommended minimum if running Jenkins as a Docker container)
Recommended hardware configuration for a small team:
1 GB+ of RAM
50 GB+ of drive space
Jenkins requires Java versions 8 or 11 on the system. For OpenJDK installation on CentOS 8, can be found on How To Install Java (OpenJDK 11) On CentOS 8 article. Our system has already java installed, we can verify it by submitting command line :
[ramans@otodiginet ~]$ java -version openjdk version "11.0.8" 2020-07-14 LTS OpenJDK Runtime Environment 18.9 (build 11.0.8+10-LTS)
Jenkins installation will be started by adding Jenkins repository until starting its services.
Adding Jenkins Repository
Jenkins is not included in the default CentOS software repositories, so we have to add it manually then importing its GPG key by submitting command line :
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo and
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key.
[ramans@otodiginet ~]$ sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo [sudo] password for ramans: --2020-12-22 18:58:03-- https://pkg.jenkins.io/redhat-stable/jenkins.repo Resolving pkg.jenkins.io (pkg.jenkins.io)… 18.104.22.168, 2a04:4e42:2::645 Connecting to pkg.jenkins.io (pkg.jenkins.io)|22.214.171.124|:443… connected. HTTP request sent, awaiting response… 200 OK Length: 85 Saving to: ‘/etc/yum.repos.d/jenkins.repo’ /etc/yum.repos.d/jenkins. 100%[===================================>] 85 --.-KB/s in 0s 2020-12-22 18:58:04 (1.56 MB/s) - ‘/etc/yum.repos.d/jenkins.repo’ saved [85/85] [ramans@otodiginet ~]$ sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
After Jenkins repository has been added to our system, the we will install it by submitting command line :
yum install jenkins.
[ramans@otodiginet ~]$ sudo yum install jenkins Jenkins-stable 18 kB/s | 19 kB 00:01 Last metadata expiration check: 0:00:01 ago on Tue 22 Dec 2020 06:59:11 PM PST. Dependencies resolved. Package Architecture Version Repository Size Installing: jenkins noarch 2.263.1-1.1 jenkins 64 M Transaction Summary Install 1 Package Total download size: 64 M Installed size: 64 M Is this ok [y/N]: y Downloading Packages: jenkins-2.263.1-1.1.noarch.rpm 87 kB/s | 64 MB 12:30 Total 87 kB/s | 64 MB 12:30 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: jenkins-2.263.1-1.1.noarch 1/1 Installing : jenkins-2.263.1-1.1.noarch 1/1 Running scriptlet: jenkins-2.263.1-1.1.noarch 1/1 Verifying : jenkins-2.263.1-1.1.noarch 1/1 Installed products updated. Installed: jenkins-2.263.1-1.1.noarch Complete!
Starting Jenkins Service
Once the installation process is complete, then we have to start the Jenkins service and enable it to start on system boot, by submitting command line :
sudo systemctl start | enable | status jenkins.
[ramans@otodiginet ~]$ sudo systemctl start jenkins [ramans@otodiginet ~]$ sudo systemctl enable jenkins jenkins.service is not a native service, redirecting to systemd-sysv-install. Executing: /usr/lib/systemd/systemd-sysv-install enable jenkins [ramans@otodiginet ~]$ sudo systemctl status jenkins ● jenkins.service - LSB: Jenkins Automation Server Loaded: loaded (/etc/rc.d/init.d/jenkins; generated) Active: active (running) since Tue 2020-12-22 19:20:14 PST; 15s ago Docs: man:systemd-sysv-generator(8) Tasks: 32 (limit: 49614) Memory: 246.8M CGroup: /system.slice/jenkins.service └─6996 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -> Dec 22 19:20:12 otodiginet systemd: Starting LSB: Jenkins Automation Server… Dec 22 19:20:13 otodiginet runuser: pam_unix(runuser:session): session opened for user jenkins > Dec 22 19:20:14 otodiginet runuser: pam_unix(runuser:session): session closed for user jenkins Dec 22 19:20:14 otodiginet jenkins: Starting Jenkins [ OK ] Dec 22 19:20:14 otodiginet systemd: Started LSB: Jenkins Automation Server.
Enabling Firewall for Jenkins
We have to open port that is used by Jenkins daemon to enable the connection from outside the system. These step is done by submitting command line :
ramans@otodiginet ~]$ sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp success [ramans@otodiginet ~]$ sudo firewall-cmd --reload success
Setting Up Jenkins
After all installation steps is completed done successfully, then we have to configure it via browser. To start the Jenkins setup process, we have to open web browser and type the domain or server’s IP address followed by port
8080. To retrieve temporary admin password, we will get it from
[ramans@otodiginet ~]$ sudo more /var/lib/jenkins/secrets/initialAdminPassword [sudo] password for ramans: d4ee060068484324ad56b73c0795ed66
On this article we have completed the tutorial about Jenkins installation on CentOS 8 successfully. For further information about Jenkins, it can be discovered on Jenkins website. Have a nice weekend.