Jenkins is a topnotch application.Originally started as Hudson in 2004 but due to a conflict in 2011 they divided and continued under the name, Jenkins. It enables one to build software, deploy software, or websites to various endpoints or to run unit/behaviour-driven software tests. In this blog, I will demonstrate how to install, configure Jenkins, and create your first job.
Step 1. Verify Java Installation
If java is installed then, you will see java version like:
java version "1.8.0_77" Java(TM) SE Runtime Environment (build 1.8.0_77-b03) Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
If Java is not installed, then follow the step 2 to install and set JAVA_HOME path
Step 2: Install Java and Set JAVA_HOME
$ sudo add-apt-repository ppa:webupd8team/java $ sudo apt-get update $ sudo apt-get install oracle-java8-installer $ sudo apt-get install oracle-java8-set-default $ cd /usr/lib/jvm/ $ ls -l drwxr-xr-x 4 root root 4096 Apr 16 11:07 ./ drwxr-xr-x 163 root root 20480 Apr 11 06:57 ../ lrwxrwxrwx 1 root root 24 Mar 23 2014 default-java -> java-1.7.0-openjdk-amd64/ lrwxrwxrwx 1 root root 20 Mar 24 16:08 java-1.7.0-openjdk-amd64 -> java-7-openjdk-amd64/ -rw-r--r-- 1 root root 2439 Mar 24 16:07 .java-1.7.0-openjdk-amd64.jinfo drwxr-xr-x 5 root root 4096 Apr 16 11:07 java-7-openjdk-amd64/ drwxr-xr-x 8 root root 4096 Apr 1 08:35 java-8-oracle/ -rw-r--r-- 1 root root 2643 Apr 1 08:35 .java-8-oracle.jinfo
Then change directory to latest java
$ cd java-8-oracle $ pwd /usr/lib/jvm/java-8-oracle $ sudo vi /etc/environment
Add below path as per your java installation at end of file
$ source /etc/environment $ echo $JAVA_HOME
Step 3. Install jenkins.
Before you can install Jenkins, add the key and source list to apt. First add the key:
$ wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | apt-key add -
Then, create a sources list for Jenkins:
echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list
Update apt’s cache before installing Jenkins:
$ apt-get update
After the cache has been updated, proceed with installing Jenkins. Please note that it has a large bunch of dependencies, so it might take a few moments to install them all.
$ apt-get install jenkins
Jenkins will be launched as a daemon up on start. Check /etc/init.d/jenkins for more details. To run this service a ‘jenkins’ user is created. The log file will be placed in /var/log/jenkins/jenkins.log . Check this file when in need for troubleshooting.
Step 4. Start Jenkins service.
$ /etc/init.d/jenkins start $ /etc/init.d/jenkins start
Jenkins will write log files to /var/log/jenkins/jenkins.log. You can also fine-tune the configuration.
Step 5. Access Jenkins.
Finally, after the installation is complete you can visit the following address in your browser http://your-ip-address:8080
Congratulation’s! You have successfully installed jenkins.