How to setup Jenkins on Ubuntu Server 18.04

  • by

This is a post about how to install Jenkins. It is not a post to tell you what jenkins is. If you are looking for information on what Jenkins is and what it does go to their website –> https://jenkins.io/

The first thing you will want to do is decide where to install jenkins. This tool can be installed on your windows and linux system. It can be installed in Azure, AWS or your own private server.

For this post we will be setting up Jenkins on an Unbuntu Server 18.04. There are other ways of doing this, but this is one of them!

1.) Log into your system and type: sudo su to get root access. This will allow you to run the commands we need.

2.) Issue the command: sudo apt install default-jdk-headless – This will install the version of Java that we need. Jenkins requires java to run.

3.) Verify your java installation using: java –version

4.) Run the following commands and install the necessary GPG key with the commands:  

wget -q -O – https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add

5.) sudo sh -c ‘echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list’

6.) sudo add-apt-repository universe

7.) sudo apt-get update

8.) sudo apt-get install jenkins

Congratulations! If you followed these steps you now have Jenkins installed on your system. You can now verify the status of your new service using the systemctl command in your linux server terminal.

Next I will list some commands that you can use to start, stop, find status and to automatically start jenkins. You will also need to open your firewall so you can access it from other computers.

1.) sudo systemctl status jenkins – Gives you the jenkins status. At this point it is probably not started.

2.) sudo systemctl start jenkins – Starts the jenkins server.

3. ) sudo systemctl enable jenkins – It will automatically start jenkins after a reboot.

4.) Open your browser and go to the ip address of the server and use port :8080. For example: 10.0.0.100:8080 or 122.12.23.77:8080.

Leave a Reply

Your email address will not be published. Required fields are marked *