Install Jenkins on Ubuntu
Introduction to Jenkins
Jenkins is an open source DevOps tool which is basically use to automate repetitive tasks like code deployment on server. Main purpose of Jenkins is to do continuous integration and delivery of software.
Continuous Integration is a process where dev team writes their code and integrate it to a central repository like Git or SVN. This process required a continuous build process through which developers can deploy their code and unit test at a regular interval.
We can install Jenkins with basic sets of plug-ins. It can be extended by installing various plug-ins as per our requirement. For example if we want to use Git with Jenkins we can install the git plug-in or if we need SonarQube to test the code quality before the deployment then we can install the plug-in for SonarQube. I will cover the integration with SonarQube in later blogs so stay tuned.
Prerequisites:
For installing Jenkins on Ubuntu we need following:
1) A machine with Ubuntu 16.04 or higher.
2) A non root user with sudo privilege.
3) At-least 1GB of RAM.
Installation on Ubuntu:
Jenkin is based on JAVA and we can install it in different ways like using the package manager or by downloading the WAR file.
Method 1:
First step is to add the repository key:
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
We will get OK in the response of the above command.
Second step is to appennd this debian package repository to the server's source.list
echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list
Third step is to update the system repository
sudo apt-get update
Fourth step is to install Jenkins
sudo apt-get install jenkins
Method 2:
Download the debian software package from here.
https://pkg.jenkins.io/debian/binary/jenkins_2.124_all.deb
Check file and if execute permission is not there please give execute permission using following command
sudo chmod +x jenkins_2.124_all.deb
Install Jenkins using following command
sudo dpkg -i jenkins_2.124_all.deb
Start and check the status:
Now start Jenkins and verify the status
sudo systemctl start jenkins
sudo systemctl status jenkins
Access Jenkins:
Now we can open Jenkins through browser by opening following URL:
http://localhost:8080
Configure Jenkins:
For the first time Jenkins will prompt to unlock and will tell us to copy the password from following location:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
We can copy the password and paste it against Administrator password test box. After that it will ask to choose the plug-in option. We can pick the suggested plug-ins for now, it will install those plug-in and then will ask to create the first admin user. After creating the admin account it will show the message as 'Jenkins is ready !'
If you want to know the Jenkins and SonarQube installation process and configuration then refer to my previous blog:
Why SonarQube is important for IT projects ?
Configure Jenkins for Automated Code Deployment
SonarQube installation on Ubuntu
Configure SonarQube Scanner with Jenkins
Analyze your project with SonarQube
In this way we can install Jenkins on Ubuntu machine. Please feel free to comment in case you have any queries.
Comments (0)
Leave a comment
Related Blogs
Introduction to Logstash
Dec 20, 2019, 11:38:31 AM | Anurag Srivastava
Importing MongoDB data into Elasticsearch
Mar 9, 2019, 8:20:38 AM | Anurag Srivastava
Importing MySQL data into Elasticsearch
Feb 9, 2019, 12:06:18 PM | Anurag Srivastava
Snapshot and Restore Elasticsearch Indices
Sep 16, 2019, 5:55:06 AM | Anurag Srivastava
Log analysis with Elastic stack
Jan 31, 2018, 6:11:29 AM | Anurag Srivastava
Creating Elasticsearch Cluster
Apr 6, 2019, 8:41:41 PM | Anurag Srivastava
Top Blogs
Configure SonarQube Scanner with Jenkins
Jun 21, 2018, 4:58:11 AM | Anurag Srivastava
Execute Commands on Remote Machines using sshpass
Jul 16, 2018, 5:00:02 PM | Anurag Srivastava
Importing MongoDB data into Elasticsearch
Mar 9, 2019, 8:20:38 AM | Anurag Srivastava
Importing MySQL data into Elasticsearch
Feb 9, 2019, 12:06:18 PM | Anurag Srivastava
Configure Jenkins for Automated Code Deployment
Jun 13, 2018, 3:44:01 PM | Anurag Srivastava
Deploying Angular code using Python script
Jun 26, 2018, 4:50:18 PM | Anurag Srivastava