Here Today we have started new Tutorials series on Jenkins. we will cover all the topics on Jenkins pipelines so stay with us and follow this our blog to more.
What is Jenkins: Jenkins is a self-contained, open-source automation server which can be used to automate all tasks related to building, testing, and deployment of these build on Server which can be a Virtual machine or Cloud instance on AWS, Azure or GCP.
Jenkins can be installed through native systems packages, Docker, or even run standalone on the machine by installing binary but the machine should have installed Java Runtime Environment(JRE) because Jenkins builds in java so java required on the server.
- Updated Linux Machine.
- Java Runtime Environment(version 8 or more)
As we said, Java Should be installed on a machine before installation Jenkins on the machine. so first we will install JRE version 11 on the machine. as to fulfill this requirement we will install a default-jre on a machine. follow the below steps on a terminal to install java runtime environment.
On Debian/Ubuntu: run below commands to install java
1. sudo apt-get install default-jre
by hitting this command default-jre will be installed on your machine to verify just run the command java -version on the machine you will get installed version of java. after that, we can proceed with the installation on Jenkins.
On RedHat/CentOs:- run below commands:
1. yum update to update the system.
2. sudo yum install java-1.8.0-openjdk-devel.x86_64
Jenkins released two types of Jenkins release Long-term Support release and Weekly release. we will install Long-term support release as long-term support provides 12-week support which means Jenkins will release an update every 12-week.
As we know, Linux has multiple flavors like centos, ubuntu. these are two mostly used machines widely as servers so we will know the procedure of installation on both types of machines.
On Debian or Debian-based Distribution like Ubuntu, you can install Jenkins through an apt package manager or you can install Jenkins through yum on Red Hat Enterprise Linux, CentOs, and other Red Hat Based distributions.
An LTS (Long-term Support) release means Jenkins update binary on every 12-week and provides to end-users through apt or it can be installed from the Debian-stable apt repository.
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
if an error is reported, “Jenkins : Depends: daemon but it is not installable”, add the “universe” apt repository of community maintained free and open-source software for ubuntu by executing this command after sudo apt-get update:
sudo add-apt-repository universe
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key sudo yum upgrade sudo yum install jenkins
This package installation will:
- Setup Jenkins as a daemon launched on start. See /etc/init.d/jenkins for more details.
- Create a ‘Jenkins’ user to tun this service.
- Direct console log output to the file /var/log/jenkins/jenkins.log. Check this file if you are troubleshooting Jenkins.
- Populate /etc/default/jenkins with configuration parameter fot the launch, e.g JENKINS_HOME
- Set Jenkins to listen on port 8080. Access this port with your browser to start the configuration.
Start Jenkins Service:
You can start 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
If everything has been set up correctly. you should see an output like this:
Loaded: loaded (/etc/rc.d/init.d/jenkins; generated) Active: active (running) since Tue 2018-11-13 16:19:01 +03; 4min 57s ago
Now redirect to web browser and hit the URL localhost:8080 and you will get to see the screen shown in the below screenshot.
to continue you need initialAdminPassword to get this token view the file in /var/lib/jenkins/secrets/initialAdminPassword by hitting below command and hit Enter:
- cat /var/lib/jenkins/secrets/initialAdminPassword
Now you have to choose which plugins will be installed with Jenkins install.
I have chosen Install Suggested Plugins and hit continue. after you will get below screen where plugins are getting installed.
Now You will get a screen to create Jenkins login user, create one and hit Save and continue then you will get below screen and congratulation you have installed Jenkins successfully.
After successful installation you will get the home screen of Jenkins which is like below:
Now Jenkins installed. Enjoy…
Also, follow the blog we are updating tutorials on different technologies.
Also, subscribe to our YouTube Channel and other social media account published on the website to support us.