Hamsa K
5 min read | 5 months ago

How to Install Jenkins on Centos 8

Install jenkins on centos 8

Jenkins is a free and open source automation server. Jenkins helps to automate the non-human part of the software development process, with continuous integration and facilitating technical aspects of continuous delivery. It is a server-based system that runs in servlet containers such as Apache Tomcat. It supports version control tools, including AccuRev, CVS, Subversion, Git, Mercurial, Perforce, TD/OMS, ClearCase and RTC, and can execute Apache Ant, Apache Maven and sbt based projects as well as arbitrary shell scripts and Windows batch commands.

Jenkins is opensource continuous integration tool written in Java that allows developers to continuously develop, test and deploy code in a simple way.

Step 1: Install java 

 Jenkins is build in JAVA, so we have to install JAVA on the server

[root@centos ~]# yum install java-11-openjdk-devel

After installing java verify java with below command

[root@centos ~]# java --version
openjdk 11.0.5 2019-10-15 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.5+10-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.5+10-LTS, mixed mode, sharing)

Step 2: Add jenkins repository

we will add Jenkins Repository in server. so we can install it as Jenkins is not available in CentOS default repository.Add jenkins key like below

[root@centos ~]# rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key

Now add jenkins repo to our system.

[root@centos ~]# cd /etc/yum.repos.d/
[root@centos yum.repos.d]# wget https://pkg.jenkins.io/redhat-stable/jenkins.repo

Step 3: Install jenkins

[root@centos ~]# yum install jenkins

After installing jenkins start and enable autostart on system boot.

[root@centos ~]# systemctl start jenkins
[root@centos ~]# systemctl enable jenkins
jenkins.service is not a native service, redirecting to systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable jenkins

verify service status with below command.

[root@centos ~]# systemctl status jenkins
● jenkins.service - LSB: Jenkins Automation Server
   Loaded: loaded (/etc/rc.d/init.d/jenkins; generated)
   Active: active (running) since Sat 2020-02-15 16:46:06 IST; 20s ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 22 (limit: 11527)
   Memory: 205.5M
   CGroup: /system.slice/jenkins.service
           └─2234 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war ->
Feb 15 16:45:58 centos systemd[1]: Starting LSB: Jenkins Automation Server...
Feb 15 16:45:58 centos runuser[2218]: pam_unix(runuser:session): session opened for user jenkins by (uid=0)
Feb 15 16:46:06 centos jenkins[2211]: [30B blob data]
Feb 15 16:46:06 centos systemd[1]: Started LSB: Jenkins Automation Server.

Step 4: Allow port in firewall

If firewall is running on your system,you can allow 8080 port to alllow Jenkins portal from external systems.

[root@centos ~]# firewall-cmd --add-port=8080/tcp --permanent
[root@centos ~]# firewall-cmd --reload

check jenkins port by following command.

[root@centos ~]# netstat -ntpl | grep 8080
tcp6       0      0 :::8080                 :::*                    LISTEN      1681/java

Step 5: Setup jenkins

open your browser and type your ipaddress followed by port 8080

Copy the password from the /var/lib/jenkins/secrets/initialAdminPassword file in Jenkins instance and paste in the following window. Click on continue

Here we select the first option, which is “Install suggested plugins.” If you want to install more plugins, then select the second option, which is “Select plugins to install.

The plugin installation started.

Enter the Username, Password, Confirm password, Full name, E-mail address in the following window. Click on 'save and contunue'

The Instance configuaration section will provide you with the default Jenkins URL.click save and finish.

 setup is now complete. To access the Jenkins dashboard, simply click on ‘start using jenkins.

Jenkins dashboard will be display like below.Now, you can create your first job in Jenkins.




Warning! This site uses cookies
By continuing to browse the site, you are agreeing to our use of cookies. Read our terms and privacy policy