Install Jenkins on Ubuntu

In this tutorial we are going to install Jenkins on Ubuntu operating system. Ubuntu is another debian based operating system – open sourced and highly loved by developer community.

If you are looking for other ways to install Jenkins you can try below tutorials:
1. Installing Jenkins on Tomcat server.
2. Installing Jenkins as Docker Container.

In this tutorial, we will be using docker like previous tutorial for starting ubuntu linux terminal, we can use ubuntu VM, but that would be an overkill for this tutorial. But both will work the same.

So lets start our tutorial.

Check if docker is running or not – if not start the docker service accordingly based on which ever OS you are currently.

Run >/docker version, you should see some like below on the screen:

If you see something like this in the output, you can move forward if not try starting docker on your machine first.

Now lets start a Ubuntu container :

>/ docker run -it -p 8080:8080 ubuntu /bin/bash

This command will down, the latest image of Ubuntu available in docker hub and start a new container which will expose any service which would be running on it at port 8080 to host machines port 8080.

we can see that I have one ubuntu container running.

I came out of Container, by pressing control + p + q -> safe container exit sequence.

For jenkins we need to install Java on the ubuntu first as jenkins need Java 1.8.

So we can do that by running command inside container :

>/ apt-get install openjdk-8-jdk

This will install Open JDK 1.8 and set the path accordingly.

Now we have to download Jenkins war file from here.

In order to download this, we need wget command on Ubuntu container, which by default would not be installed.

>/ apt-get install wget -y

This will install wget on the Ubuntu.

Now run :

>/ wget

This will download the war file to the directory where ever you would have had ran it from.

once completed, execute :

>/ java -jar jenkins.war –httpPort=8080

Now you should be knowing what to do next 🙂

References :

Gaurav Bajpai