Home » Jenkins: Install Jenkins on Linux – CentOS 7

Jenkins: Install Jenkins on Linux – CentOS 7

by Pring
Jenkins: Install Jenkins on Linux - CentOS 7

I. Introduction.

This tutorial will teaches you how to install Jenkins on Linux – CentOS 7. Jenkins is an open source, Java-based automation server that offers an easy way to set up a continuous integration and continuous delivery (CI/CD) pipeline.

II. Prerequisites.

1. Login to your system via SSH. You can use PuTTy tool or Poderosa tool,…
2. Login with root user.  If you are logged in as another user, you will need to add sudo before each command.

III. Install Jenkins on CentOS 7 by step by step.

To install Jenkins on Linux – CentOS 7. Follow these steps:

Step 1. Install Jenkins.
Step 2. Start Jenkins.
Step 3. Verify the installation.
Step 4. Adjust the Firewall.
Step 5. Get Jenkins default password.
Step 6. Setup Jenkins.

You can see details of Video on How to Install Jenkins on Linux – CentOS 7 as below.
[Sorry, the video we will update later]

Or you also can see details as below.

Step 1. Install Jenkins.

1. Update all packages on your system including yum. Enter the command below:

sudo yum install epel-release
sudo yum -y update

Jenkins is a Java Application, so if your system does not have Java JDK installed, you must install it. You can read the article: How to Install JDK and set JAVA_HOME on Linux – CentOS 7

The current version of Jenkins does not support Java 10 and Java 11 yet. So if you have multiple versions of Java installed on your machine. You are sure that Java 8 is the default Java version.

2. The next step is enable the Jenkins Repository. To import GPG key, use the following curl command.

curl –silent –location http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | sudo tee /etc/yum.repos.d/jenkins.repo

Sample Output:

[root@devopsio ~]# curl --silent --location http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | sudo tee /etc/yum.repos.d/jenkins.repo
[jenkins]
name=Jenkins-stable
baseurl=http://pkg.jenkins.io/redhat-stable
gpgcheck=1

3. Add the repository to your system with command below.

sudo rpm –import https://jenkins-ci.org/redhat/jenkins-ci.org.key

4. After the repository is enable. install the latest version of Jenkins. Enter the command below.

sudo yum install jenkins

Sample Output:

[root@devopsio ~]# sudo yum install jenkins
jenkins                                                                 | 2.9 kB  00:00:00     
jenkins/primary_db                                                      |  29 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package jenkins.noarch 0:2.176.2-1.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================
 Package              Arch                Version                   Repository            Size
===============================================================================================
Installing:
 jenkins              noarch              2.176.2-1.1               jenkins               74 M

Transaction Summary
===============================================================================================
Install  1 Package

Total download size: 74 M
Installed size: 74 M
Is this ok [y/d/N]: y
Downloading packages:
jenkins-2.176.2-1.1.noarch.rpm                                          |  74 MB  00:00:06     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : jenkins-2.176.2-1.1.noarch                                                  1/1 
  Verifying  : jenkins-2.176.2-1.1.noarch                                                  1/1 

Installed:
  jenkins.noarch 0:2.176.2-1.1                                                                 

Complete!

Step 2. Start Jenkins.

Enter the command below:

sudo systemctl start jenkins

Enable the Jenkins service to start on system boot. Enter the command below:

sudo systemctl enable jenkins

Sample Output:

[root@devopsio ~]# sudo systemctl enable jenkins
jenkins.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig jenkins on

Step 3. Verify the installation.

Enter the command below:

systemctl status jenkins

Sample Output:

[root@devopsio ~]# systemctl status jenkins
● jenkins.service - LSB: Jenkins Automation Server
   Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
   Active: active (running) since Tue 2019-08-06 16:02:23 UTC; 1min 12s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2476 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/jenkins.service
           └─2495 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headle.

Step 4. Adjust the Firewall.

If you are installing Jenkins on a remote CentOS server that is protected by a firewall you need to port 8080. So. you must open the port 8080.
Enter the command below:

sudo firewall-cmd –permanent –zone=public –add-port=8080/tcp
sudo firewall-cmd –reload

Sample Output:

[root@devopsio ~]# sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp
success
[root@devopsio ~]# sudo firewall-cmd --reload
success

Step 5. Get Jenkins default password.

To get Jenkins default password. Enter the command below:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Sample Output:

[root@devopsio ~]# sudo cat /var/lib/jenkins/secrets/initialAdminPassword
b8da48bfe7da484c92550c163cbe8bd6

Step 6. Setup Jenkins.

1. To set up your new Jenkins installation, open your browser and type your domain or IP address followed by port 8080:

http://your_ip_or_domain:8080

2. Input Jenkins default password from Step 5 then click [ continute ] button.
Jenkins: Install Jenkins on Linux - CentOS 7

3. Choose the default suggested plugin. Click on the [ Install suggested plugins ] box, and the installation process will start immediately.
Jenkins: Install Jenkins on Linux - CentOS 7

4. Install plugin…
Jenkins: Install Jenkins on Linux - CentOS 7

5. After the installation is complete, you will be prompted to set up the first administrative user. Fill out all required information and click Save and Continue.
Jenkins: Install Jenkins on Linux - CentOS 7

6. On the next page, you will be asked to set the URL for the Jenkins instance. The URL field will be populated with an automatically generated URL.
To complete the setup confirm the URL by clicking on the Save and Finish button.
Jenkins: Install Jenkins on Linux - CentOS 7

7. Finally, click on the Start using Jenkins button.
Jenkins: Install Jenkins on Linux - CentOS 7

You’ve successfully installed Jenkins on your CentOS system.

Jenkins: Install Jenkins on Linux - CentOS 7

IV. Conclusion.

In this tutorial, we was install Jenkins on Linux – CentOS 7 server. If you hit a problem or have feedback, leave a comment below.
You can now visit the official Jenkins User Documentation page and learn how to get started with Jenkins.


Install Jenkins on Linux – CentOS 7 is complete. Wish you success and luck.
Thanks and best regards!
— Pring —

Related Articles

2 comments

vurtil opmer December 7, 2019 - 8:40 am

As a Newbie, I am constantly browsing online for articles that can benefit me. Thank you

Reply
cialis professional May 30, 2020 - 8:02 pm

Thanks for your marvelous posting! I seriously enjoyed reading it,
you’re a great author.I will always bookmark your blog and definitely will come back sometime soon. I want to encourage one
to continue your great work, have a nice afternoon!

Reply

Leave a Comment