Showing posts with label Jenkins. Show all posts
Showing posts with label Jenkins. Show all posts

Sunday, February 14, 2021

How To Install Jenkins on Linux, CentOS-7

Install Jenkins on Linux, CentOS-7.


About Jenkins, why a DevOps engineer prefers Jenkins for CI/CD. Well, it is an open source continuous integration and continuous delivery (CI &CD) server with which organizations can automate their software development process.

This tutorial will teach you how to install and start Jenkins on Linux server.

Step-1 Update your Linux system.

sudo yum install epel-release

sudo yum update

Step 2: Install Java.

sudo yum install java-1.8.0-openjdk.x86_64

After installing Java you can verify it by running the flowing command.

java -version

This command will let you know the runtime environment of the java version.

openjdk version "1.8.0_91"

OpenJDK Runtime Environment (build 1.8.0_91-b14)

OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)

Step 3: Install Jenkins.

Start by importing the repository key from Jenkins.

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

After importing the key, add the repository to the system

sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-

ci.org/redhat/jenkins.repo

Now install the Jenkins package using yum or apt-get

sudo yum install jenkins

You can now start Jenkins service using:

sudo systemctl start jenkins

sudo systemctl enable jenkins

sudo systemctl status jenkins

Status should return in running state.

$ sudo 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 Thu 2018-10-25 12:25:55 EAT; 4s ago

Docs: man:systemd-sysv-generator(8)

Process: 2487 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/jenkins.service
└─2508 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/j...

Oct 25 12:25:54 jenkins.example.com systemd[1]: Starting LSB: Jenkins Automation Server...
Oct 25 12:25:54 jenkins.example.com runuser[2492]: pam_unix(runuser:session): session opened for user jenkins by (uid=0)
Oct 25 12:25:55 jenkins.example.com jenkins[2487]: Starting Jenkins [ OK ]
Oct 25 12:25:55 jenkins.example.com systemd[1]: Started LSB: Jenkins Automation Server.

Enable port 8080/tcp on the firewall to access Jenkins in web browser.

sudo firewall-cmd --add-port=8080/tcp --permanent

sudo firewall-cmd --reload

sudo firewall-cmd --list-all

Service should be listening on port 8080:

netstat -tunelp | grep 8080

tcp LISTEN 0 50 :::8080 :::*


Unblocking Jenkins.

Browse to the URL http://[serverip or hostname]:8080 to access the web installation wizard.

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


The admin password is created and stored in the log file “/var/log/jenkins/jenkins.log“. Run the below command to get the password.

sudo grep -A 5 password /var/log/jenkins/jenkins.log

Copy the password and paste it in the above windows and click continue.

In the next windows Select the option: Install suggested plugins.



As we can see required plugin installation are in the process. Once plugin installation is done. It will ask to create an Admin user.


Click on save and finish.


Enjoy automating your jobs with Jenkins.


Friday, February 12, 2021

Change Jenkins Default Port 8080 in Linux

Change Jenkins Default Port 8080 in Linux CentOS 7.

Here we will learn how to change Jenkins default port 8080 to any desired port. I will use port 8123 for my Jenkins server.


1. Open Jenkins configuration file by using vim or any editor.

 #sudo vim /etc/sysconfig/jenkins

2. Inside the configuration file find the flowing line ‘JENKINS_PORT=”8080"’ and replace the port which you want to use.

Type: integer(0:65535)
Default: 8080
ServiceRestart: jenkins
Port Jenkins is listening on
Set to -1 to disable
JENKINS_PORT=”8123"

3. After made the changes save and exit. And restart Jenkins service.

#sudo systemctl restart jenkins

4. You can verify now to accessing Jenkins on updated port.


You are done now..!! Enjoy.

What is DevOps? DevOps Kya hai?

DevOps is not a tool or a software. DevOps simply is a hassle free process to implement, develop and deliver the product to client. It'...