Install Jenkins on Ubuntu 16.04 | 17.10 | 18.04 LTS Server

Jenkins, a self-contained Java-based program which was forked from the Hudson project can easily be installed on Ubuntu… and this brief tutorial is going to show students and new users how to do it with Ubuntu 16.04 / 17.10 and 18.04 servers…
For those who don’t know about Jenkins, here’s a brief overview: It’s a leading open source automation server which provides hundreds of plugins to support building, deploying and automating any project.
Out-of-the-box, it supports Windows, Mac OS X and other Unix-like operating systems… and can easily be distributed across multiple machines, helping drive builds, tests and deployments for multiple platforms efficiently…
For more about Jenkins, connect to its hompage…
When you’re ready to install Jenkins, follow the steps below:
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
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…
Enjoy!
You may also like the post below:
Thanks
Buenos días, muy buen aporte, solo que me aparece: Permiso denegado, sabes por que
if you don’t have browser in your machine. then how to open jenkins
Thanks .. of great help .. :)
The JDK repo no longer works due to Oracle’s java update restrictions