Site icon WPDig.com

How to install Jenkins on Ubuntu Linux

This post shows students and new users how to install Jenkins on Ubuntu Linux. Jenkins, an open source Java-based standalone automation server that can be used to easily configure Continuous Integration and Continuous Delivery (CI / CD) pipelines.

Jenkins is quite versatile. It can be installed as a standalone application, a Java servlet container like Apache Tomcat, or run as a Docker container. It is a leading open source automation server that provides hundreds of plugins to support the construction, deployment and automation of any project.

Out of the box, it is compatible with Windows, Mac OS X, and other Unix-like operating systems. and it can be easily distributed across multiple machines, helping to drive cross-platform builds, tests, and deployments efficiently.

To learn more about Jenkins, connect to your 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 work. You can install Oracle Java JDK or its open source alternative called OpenJDK.

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

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

sudo apt update
sudo apt install default-jdk

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

java -version

The command should generate something similar to the following lines:

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 must be installed and ready to use

How to add Jenkins repository in Ubuntu

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

Run the following commands to import the GPG keys from the Jenkins repository with the following wget command.

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

Then run the following commands 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 above commands 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 the Jenkins repository has been added to Ubuntu, run the following commands to install Jenkins.

sudo apt update
sudo apt install jenkins

After installation, the Jenkins service will start automatically after the installation process completes. To check if Jenkins is installed and running, run the following commands:

sudo systemctl status jenkins.service

You should see output similar to the following:

● 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 following commands can also be used to start, stop, and enable the Jenkins service to start automatically when the system starts.

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

How to set up Jenkins on Ubuntu

To configure your new Jenkins installation, open your browser, type the server’s hostname or IP address followed by the port 8080, http: // hostname: 8080 A screen similar to the following will appear:

http: // localhost: 8080

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

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

That should show the password to use. Copy and paste it in the box and continue.

On the next screen, you will be asked if you want to install the suggested plugins or select plugins to install. For the sake of simplicity, click the Install Suggested Plugins Box, and the installation process will begin immediately.

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

The URL of the Jenkins instance should auto-fill. Accept the default or change to the server hostname or domain name and save. then finish.

That should complete the Jenkins installation.

Click the Start Using Jenkins button and the setup should automatically log into the backend.

You should do that!

Conclusion:

In this tutorial we have seen how to install Jenkins on Ubuntu Linux. If you find any errors above or have something to add, use the comment form below.

Exit mobile version