
Jenkins is an open source continuous integration tool developed in Java.
Adding Repositories to Install Java 8
Adding repositories:
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
Adding the package verification certificate:
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
Updating repositories:
apt-get update
Installing Java 8
Install the Java 8 package and accept its terms of use:
apt-get install oracle-java8-installer
Installing Jenkins
We will use wget to download the Jenkins .war file:
apt-get install wget
wget mirrors.jenkins.io/war-stable/latest/jenkins.war
Starting Jenkins
Start Jenkins on port 8080:
java -jar jenkins.war --httpPort=8080
Jenkins is then accessible through a browser. When Jenkins is started with this command, the console running it must remain open. To work around this, we will use “screen” to run Jenkins in the background.
Running Jenkins in the Background
The “screen” utility allows running applications in the background.
Installing screen:
apt-get install screen
Running Jenkins with screen:
screen -dmS jenkins java -jar jenkins.war --httpPort=8080
After this command, Jenkins will start in the background and remain accessible through the browser without needing an open console.
More info on screen: https://doc.ubuntu-fr.org/screen