Hello good people. In this article, we’ll have a look at how to install Jenkins on Ubuntu 18.04 with codename Bionic Beaver. We’ll install the latest version of Jenkins on Ubuntu Bionic Beaver.
Jenkins is an open source automation server written in Java that was designed to automate repetitive tasks that are often encountered in continuous integration and delivery of software.
For Arch Linux: How to Install and Configure Jenkins on Arch Linux
For CentOS 7: How to install Jenkins Server Stable on CentOS 7
For Docker Container: Running Jenkins Server in Docker Container with Systemd
Install Jenkins on Ubuntu 18.04 – Prerequisites:
- Minimum of 1gb ram
- Update Ubuntu 18.04 server
- A user with sudo privileges
Install Jenkins on Ubuntu 18.04 ( Bionic Beaver ) – Steps
Let’s start the installation of by doing a system update and upgrade:
# apt-get update Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB] Hit:2 http://mirrors.digitalocean.com/ubuntu bionic InRelease Get:3 http://mirrors.digitalocean.com/ubuntu bionic-updates InRelease [83.2 kB] Get:4 http://mirrors.digitalocean.com/ubuntu bionic-backports InRelease [74.6 kB] Get:5 http://mirrors.digitalocean.com/ubuntu bionic-updates/main amd64 Packages [119 kB] Get:6 http://mirrors.digitalocean.com/ubuntu bionic-updates/universe amd64 Packages [79.8 kB] Fetched 440 kB in 2s (224 kB/s) Reading package lists... Done # apt-get upgrade
You may need to reboot your system before you can proceed since system upgrade may update the kernel.
Add Jenkins repository to Ubuntu 18;04
The version of Jenkins available on Ubuntu 18.04 is older than the upstream version, we’ll use the project-maintained packages to install Jenkins. Add repository key using the command:
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
Once the key has been added, We need to add Jenkins stable Debian package repository
echo "deb https://pkg.jenkins.io/debian-stable binary/" | sudo tee /etc/apt/sources.list.d/jenkins.list
Then update the apt packages index:
$ sudo apt-get update Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease Hit:2 http://mirrors.digitalocean.com/ubuntu bionic InRelease Hit:3 http://mirrors.digitalocean.com/ubuntu bionic-updates InRelease Hit:4 http://mirrors.digitalocean.com/ubuntu bionic-backports InRelease Ign:5 https://pkg.jenkins.io/debian-stable binary/ InRelease Get:6 https://pkg.jenkins.io/debian-stable binary/ Release [2042 B] Get:7 https://pkg.jenkins.io/debian-stable binary/ Release.gpg [181 B] Get:8 https://pkg.jenkins.io/debian-stable binary/ Packages [12.9 kB] Fetched 15.1 kB in 1s (17.6 kB/s) Reading package lists... Done
Once this is done, install openjdk-8-jdk since Jenkins doesn’t work fine with java 9
sudo apt-get install openjdk-8-jdk
If you have more than one version of Java JDK installed, you can select version 8 as default using the command:
$ sudo update-alternatives --config java There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java Nothing to configure.
Then install Jenkins
sudo apt-get install jenkins
If you happen to be using ufw firewall for Ubuntu, open port 8080 on the firewall
Configuring Jenkins on Ubuntu 18.04
To set up Jenkins installation, visit port 8080 on your server address – domain or IP Address.
The first screen will show the “Unlock Jenkins” message. This indicates the location of the initial password.
Copy Password file:
# cat /var/lib/jenkins/secrets/initialAdminPassword 0beb2d7b9bff41079271b5596be431f9
Enter the password on Administrator Password box and click continue. The next page will ask you to install recommended plugins or plugins that suit your desired Jenkins usage. if not sure, select installation of recommended plugins.
The next page is on setting your login user account:
FInish and log in to Jenkins Dashboard to start administering it.