- Initial Configuration
- Unlock Jenkins
- Install Plugins
- Create the Admin User
- Configuration Complete
Jenkins is the most widely used open source continuous integration and automation server. It provides a vast variety of community plug-ins to support building, deploying and automating any project, big or small. In its latest version, which we are going install on Ubuntu 16.04, Jenkins becomes more mature and user-friendly.
Check if Java is installed
A simple way to verify that Java is not present is to write
java in the terminal and hit the enter key.
You should see output similar to the following:
The program 'java' can be found in the following packages: * default-jre * gcj-5-jre-headless * openjdk-8-jre-headless * gcj-4.8-jre-headless * gcj-4.9-jre-headless * openjdk-9-jre-headless Try: sudo apt install <selected package>
Clearly we can understand that Java is not installed and we should install it by selecting a proposed package.
Before installing Java, we need to update the apt cache:
sudo apt-get update
sudo apt-get install openjdk-8-jre-headless -y
Now verify that it installed:
You should see output like the following:
openjdk version "1.8.0_111" OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2ubuntu0.16.04.2-b14) OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode)
Before installing Jenkins, add the key and then the sources list to apt.
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add - sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
Update again apt's cache with the new changes.
sudo apt-get update
sudo apt-get install jenkins -y
Check that Jenkins is up and running:
sudo jenkins service status
By default, Jenkins runs on port
8080. My public IP address for this example is
126.96.36.199. Make a note of your pubic IP address as we'll need it shortly.
Right after we install Jenkins, we can open a browser and go to
http://your_ip_address:8080 to see the following:
Due to the fact that there were too many insecure Jenkins installations deployed with the previous versions, Jenkins 2 is locked by default.
In order to unlock it as the administrator write in the terminal:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
You will get a randomly generated initial password like this one:
Copy the password and then paste it in the provided input field.
The problem with the previous Jenkins versions was that getting started with it was rather intimidating due to the fact that there were no "batteries included".
There are far too many plugins in the Jenkins ecosystem and a new user had to search through long lists of them with strange names until she could find the one that would match her needs.
Fortunately, the community took notice of this situation and Jenkins 2 can be set up from the beginning with the plugins that the Jenkins community recommends.
Alternatively, if you do not want the Jenkins installation to be bloated with things that you won't need, you can select the specific ones you would like to install.
Create the Admin user
When the installation is completed, you should create the admin user. Enter the required details and hit "Save and Finish".
Jenkins is ready and you can start working with it. Good job!
We now have a functional installation of Jenkins 2. Stay tuned for additional tutorials on working with Jenkins 2.