Jenkins installation on Linux

Nael Marwan
3 min readJan 25, 2021

--

What is Jenkins?

Jenkins is a powerful application that allows continuous integration and continuous delivery of projects, regardless of the platform you are working on.

By using Jenkins, software companies can accelerate their software development process, as Jenkins can automate build and test at a rapid rate.

Jenkins supports the complete development lifecycle of software from building, testing, documenting the software, deploying and other stages of a software development lifecycle.

Before moving forward with Jenkins Setup let’s install Java, Git, and Maven.

Install Git

yum install git

Install Java

sudo apt updatesudo apt install default-jdk

To check the version of Java running, use the command:

java –version

To set up the JAVA_HOME variable, you first need to find where Java is installed. Use the following command to locate it:

sudo update-alternatives --config java

The Path section shows the locations, which are in this case:

  • /usr/lib/jvm/java-11-openjdk-amd64/bin/java (where OpenJDK 11 is located)
  • /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java (where OpenJDK 8 is located)\

2. Once you see all the paths, copy one of your preferred Java version.

3. Then, open the file /etc/environment with any text editor. In this example, we use Nano:

nano /etc/environment

4. At the end of the file, add a line that specifies the location of JAVA_HOME in the following manner:

JAVA_HOME=”/java/..../path/”

Install Maven

sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.reposudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.reposudo yum install -y apache-maven

To check the version of Maven running, use the command:

mvn –version

Install Jenkins

wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | 
sudo apt-key add -
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > \
/etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins

Start Jenkins

You can start the Jenkins service with the command:

sudo systemctl start jenkins

You can check the status of the Jenkins service using the command:

sudo systemctl status jenkins

Now let’s Get Started with Jenkins Setup. First, we need to get jenkins Admin Password by running the below commands:

cd /var/lib/jenkins/secretscat initialAdminPassword

Copy and paste the password to ‘Administrator Password’ text field.

On the next page select the necessary plugins, you need to install.

Eventually, Jenkins is already running and you can create new jobs by selecting the project style you need.

Happy Testing 😊

--

--

Nael Marwan
Nael Marwan

Written by Nael Marwan

Automation Development professional with 9+ years’ experience programming in Java. Highly skilled in programming, QA automation testing.

No responses yet