Install Jenkins on Ubuntu 18.04
- Puneeth K P
- Dec 24, 2018
- 2 min read

Step 1: Install Java
Since Jenkins requires Java, you must first install it… Oracle Java is recommended and the PPA below contains it for Ubuntu..
To add the PPA which contains Java, run the commands below
sudo add-apt-repository ppa:webupd8team/java
After running the commands above, you should see a prompt to accept the PPA key onto Ubuntu… accept and continue
Continue below to install Java 8…
Step 2: Download Oracle Java 8 Installer
Now that the PPA repository has been added to Ubuntu, run the commands below to download Oracle Java 8 installer…. the installer should install the latest Java JDK 8 on your Ubuntu machines.
sudo apt update
sudo apt install oracle-java8-installer
When you run the commands above you’ll be prompted to access the license terms of the software… accept and continue..
Step 3: Configure Oracle JDK8 as Default
Set Oracle JDK8 as default, to do that, install the oracle-java8-set-default package. This will automatically set the JAVA env variable.
sudo apt install oracle-java8-set-default
The command above will automatically set Java 8 as the default… and that should complete your installation, you can check you java version by running following command.
javac -version
Step 4: Install Jenkins
Now that Java is installed, follow the guide below to install Jenkins…
First run the commands below to add Jenkins repository to your system… First add the repository key…
cd /tmp && wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
Then run the commands below to add the repository…
echo 'deb https://pkg.jenkins.io/debian-stable binary/' | sudo tee -a /etc/apt/sources.list.d/jenkins.list
After that, run the commands below to install Jenkins
sudo apt update
sudo apt install jenkins
After installing Jenkins, the commands below can be used to stop, start and enable Jenkins to alwyas start up when the server boots…
sudo systemctl stop jenkins.service
sudo systemctl start jenkins.service
sudo systemctl enable jenkins.service
Next, open your browser and browse to the server hostname or IP address followed by port # 8080
http://localhost:8080
When you that, you’ll get a prompt to enter the initial admin password… run the commands below to view it on the system…
cat /var/lib/jenkins/secrets/initialAdminPassword
Copy and paste it into the field and continue with the setup… Install all plugins… and wait for the process to complete… after that you’ll create an admin account and complete the installation…
Comments