How to Install Jenkins on Ubuntu Linux

laptop 4156928 640
laptop 4156928 640

This guide shows how to install Jenkins, an open-source Java-based automation server, on Ubuntu Linux. It clarifies Jenkins’ versatility and compatibility with various operating systems. Installation involves setting up Java JDK, importing GPG keys for the Jenkins repository with wget, installing Jenkins, and verifying it through the command line. The guide also provides steps for enabling Jenkins to start at boot time and setting up the application via browser interface.

This post shows students and new users how to install Jenkins on Ubuntu Linux. Jenkins is an open-source, self-contained Java-based automation server that can easily set up continuous integration and continuous delivery (CI/CD) pipelines.

Jenkins is pretty versatile. It can be installed as a standalone app, a Java servlet container such as Apache Tomcat, or a Docker container. It’s a leading open-source automation server with hundreds of plugins to support building, deploying, and automating any project.

It supports Windows, Mac OS X, and other Unix-like operating systems out of the box. It can easily be distributed across multiple machines, helping efficiently drive multiple platform builds, tests, and deployments.

For more about Jenkins, connect to its homepage.

When you’re ready to install Jenkins, follow the steps below: When you’re ready to install Jenkins, follow the steps below:

How to install Java on Ubuntu Linux

Jenkins requires Java JDK to be installed to function. You can either install Oracle Java JDK or its open-source alternative called OpenJDK.

For a more detailed installation of Java, read our post here.

You can also run the commands below to install the default OpenJDK on Ubuntu.

sudo apt update
sudo apt install default-jdk

Once the OpenJDK is installed, verify it by checking the Java version:

java -version

The command should output something similar to the lines below:

openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)

Java should be installed and ready to use

How to add Jenkins repository on Ubuntu

Installing Jenkins on Ubuntu Linux is relatively straightforward. Jenkins has its repository for Linux systems.

Run the commands below to import the GPG keys of the Jenkins repository using the following wget command.

wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -

Then run the commands below to add the package repository.

sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

The commands above should enable the Jenkins repository on Ubuntu. All you have to do now is install Jenkins.

How to install Jenkins on Ubuntu Linux

Now that Jenkins’ repository has been added to Ubuntu run the commands below to install Jenkins.

sudo apt update
sudo apt install jenkins

After installing, Jenkins service will automatically start after the installation process. To verify if Jenkins is installed and running, run the commands below:

sudo systemctl status jenkins.service

You should see an output similar to the one below:

● jenkins.service - LSB: Start Jenkins at boot time
   Loaded: loaded (/etc/init.d/jenkins; generated)
   Active: active (exited) since Tue 2018-10-16 10:40:32 CDT; 22s ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 0 (limit: 2321)
   CGroup: /system.slice/jenkins.service

The commands below can also be used to start, stop and enable Jenkins service to start when the system boots automatically.

sudo systemctl stop jenkins.service
sudo systemctl start jenkins.service
sudo systemctl enable jenkins.service

How to set up Jenkins on Ubuntu

To set up your new Jenkins installation, open your browser, type the server hostname or IP address followed by port 8080http://hostname:8080, and a screen similar to the following will be displayed:

http://localhost:8080

jenkins ubuntu

You will be prompted for an administrator password. To get the password, run the commands below from the Ubuntu terminal.

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

That should display the password to use. Please copy and paste it into the box and continue.

On the next screen, you’ll be prompted whether to install suggested plugins or select plugins to install. For simplicity’s sake, Click on the Install suggested plugins box, and the installation process will start immediately.

Jenkins ubuntu install

Wait for the suggested plugins to install. After that, create the first admin user account and click Save and Continue.

Jenkins ubuntu setup

Jenkins instance URL should automatically be populated. Accept the default or change to the server hostname or domain name and save. Then finish.

Jenkins ubuntu setup install

That should complete Jenkins’ installation.

Jenkins ubuntu install

Click Start using the Jenkins button, and the setup should automatically sign you into the backend.

Ubuntu setu install Jenkins

That should do it!

Conclusion:

This post showed you how to install Jenkins on Ubuntu Linux. Please use the comment form below if you find any errors above or have something to add.

Posted by
Richard

I love computers; maybe way too much. What I learned I try to share at geekrewind.com.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.