We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

45
1.498.171,75

Cart

Quantity 2.750,00
Quantity 24.100,00
Quantity 375,00
Quantity 36.000,00
Quantity 312,50

Learn how to – Install and Configure Jenkins Server on CentOS 7

Learn how to – Install and Configure Jenkins Server on CentOS 7.

How can I install Jenkins Server on CentOS 7?. Jenkins is an open source automation server written in Java that was designed to automate repetitive tasks that are often encountered in continuous integration and delivery of software. Jenkins is typically run as a standalone application in its own process with the built-in Java servlet container/application server (Jetty).

Minimum Hardware requirements:

  • 256 MB of RAM, 1 GB+ recommended
  • GB of drive space (although 10 GB is a recommended minimum if running Jenkins as a Docker container)

For Ubuntu, see: How to Install Jenkins on Ubuntu

For Arch Linux: How to Install and Configure Jenkins on Arch Linux

For Docker Container: Running Jenkins Server in Docker Container with Systemd

Step 1: Install Java OpenJDK

Jenkins requires Java in order to run, but CentOS 7 doesn’t include it by default. To install the Open Java Development Kit (OpenJDK) run the following:

sudo yum -y install epel-release
sudo yum -y install java-11-openjdk

Check to make sure that you have java installed by running:

$ java -version
openjdk version "11.0.17" 2022-10-18 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.17.0.8-2.el7_9) (build 11.0.17+8-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.17.0.8-2.el7_9) (build 11.0.17+8-LTS, mixed mode, sharing)

Step 2: Install Jenkins Server on CentOS 7

Start by importing the repository key from Jenkins:

sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key

After importing the key, add the repository to the system:

sudo yum -y install wget
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo

Then install Jenkins package using yum:

sudo yum -y install jenkins

You can now start Jenkins service using:

$ sudo systemctl start jenkins
$ sudo systemctl enable jenkins
jenkins.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig jenkins on

A check on status should return running state

$ systemctl status jenkins
● jenkins.service - Jenkins Continuous Integration Server
   Loaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-10-29 22:08:46 UTC; 19s ago
 Main PID: 1977 (java)
   CGroup: /system.slice/jenkins.service
           └─1977 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=%C/jenkins/war --httpPort=8080

Oct 29 22:08:30 cent7.mylab.io jenkins[1977]: This may also be found at: /var/lib/jenkins/secrets/initialAdminPassword
Oct 29 22:08:30 cent7.mylab.io jenkins[1977]: *************************************************************
Oct 29 22:08:30 cent7.mylab.io jenkins[1977]: *************************************************************
Oct 29 22:08:30 cent7.mylab.io jenkins[1977]: *************************************************************
Oct 29 22:08:46 cent7.mylab.io jenkins[1977]: 2022-10-29 22:08:46.888+0000 [id=31]        INFO        jenkins.InitReactorRunner$1#onAttained: Completed initialization
Oct 29 22:08:46 cent7.mylab.io systemd[1]: Started Jenkins Continuous Integration Server.
Oct 29 22:08:46 cent7.mylab.io jenkins[1977]: 2022-10-29 22:08:46.904+0000 [id=22]        INFO        hudson.lifecycle.Lifecycle#onReady: Jenkins is fully up and running
Oct 29 22:08:47 cent7.mylab.io jenkins[1977]: 2022-10-29 22:08:47.357+0000 [id=46]        INFO        h.m.DownloadService$Downloadable#load: Obtained the updated data file for hudson...avenInstaller
Oct 29 22:08:47 cent7.mylab.io jenkins[1977]: 2022-10-29 22:08:47.357+0000 [id=46]        INFO        hudson.util.Retrier#start: Performed the action check updates server successfull...he attempt #1
Oct 29 22:08:47 cent7.mylab.io jenkins[1977]: 2022-10-29 22:08:47.360+0000 [id=46]        INFO        hudson.model.AsyncPeriodicWork#lambda$doRun$1: Finished Download metadata. 18,071 ms

Enable port 8080/tcp on the firewall:

sudo firewall-cmd --add-port=8080/tcp --permanent
sudo firewall-cmd --reload
sudo firewall-cmd --list-all

The service should be listening on port 8080

$ sudo ss -tunelp | grep 8080
tcp    LISTEN     0      50     [::]:8080               [::]:*                   users:(("java",pid=1977,fd=8)) uid:997 ino:19397 sk:ffff8dc177691080 v6only:0 <->

Step 3: Unlock Jenkins on CentOS 7

Browse to the URL to access web installation wizard.

 http://[serverip_or_hostname]:8080

When you first access a new Jenkins instance, you are asked to unlock it using an automatically generated password.

Get the password from

$ cat /var/lib/jenkins/secrets/initialAdminPassword
75a6155d70b7435c9b382197c823aa35

Copy-paste the automatically-generated alphanumeric password into the Administrator password field and click Continue.

Next is to create an admin user account used to manage the Jenkins server.

Select plugins to install in the next page.

Step 4: Configure Nginx and SSL (Optional)

It is recommended to access Jenkins Server behind a Proxy server secured with SSL certificate. Check below guide.

Step 5: Configure User Roles on Jenkins

By default, Jenkins user policy allows logged in users to access anything. This should not be the case and you need to set proper user policies. Check out our Jenkins policy and user management guide below.

Let other users Login with their credentials and assign them roles which define what they can do on Jenkins server.

Recommended Video Courses For Learning Jenkins:

Conclusion

Enjoy automating your jobs with Jenkins. For more reading, check Official Documentation. We will publish more articles on Jenkins and CI/CD.

Also check:

How to Manage Users and Roles in Jenkins

Configure Jenkins behind Nginx reverse proxy and Let’s Encrypt SSL

How to Configure Jenkins FreeIPA LDAP Authentication

Running Jenkins Server in Docker Container with Systemd

Install and Configure Hashicorp Vault Server on Ubuntu / CentOS / Debian

How to Install Terraform on Ubuntu / CentOS

45
1.498.171,75

Cart

Quantity 2.750,00
Quantity 24.100,00
Quantity 375,00
Quantity 36.000,00
Quantity 312,50