Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install Jenkins on Ubuntu 20.04 - DesignLinux

Jul 17 2020
designlinux 0 Comments

Jenkins is an open-source automation server that can be used to easily set up continuous integration and continuous delivery (CI/CD) pipelines.

Continuous integration (CI) is a DevOps practice in which team members regularly commit their code changes to the version control repository, after which automated builds and tests are run. Continuous delivery (CD) is a series of practices where code changes are automatically built, tested, and deployed to production.

Jenkins can be installed as a standalone application, as a servlet in a Java servlet container such as Apache Tomcat or can be run as a Docker container.

This article explains how to install Jenkins on Ubuntu 20.04 as a standalone service.

Installing Java #

Jenkins is a Java application and requires Java 8 or later to be installed on the system. We’ll install OpenJDK 11 , the open-source implementation of the Java Platform.

Run the following commands as root or user with sudo privileges or root to install OpenJDK 11:

sudo apt updatesudo apt install openjdk-11-jdk

Once the installation is complete, verify it by checking the Java version:

java -version

The output should look something like this:

openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-3ubuntu1, mixed mode, sharing)

Installing Jenkins #

Installing Jenkins on Ubuntu is relatively straightforward. We’ll enable the Jenkins APT repository, import the repository GPG key, and install the Jenkins package.

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 -

Next, add the Jenkins repository to the system with:

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

Once the Jenkins repository is enabled, update the apt package list and install the latest version of Jenkins by typing:

sudo apt updatesudo apt install jenkins

If you get an error message saying:

Error: W: GPG error: https://pkg.jenkins.io/debian-stable binary/ Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 9B7D32F2D50582E6"

Import the key with:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9B7D32F2D50582E6

Jenkins service will automatically start after the installation process is complete. You can verify it by printing the service status:

systemctl status jenkins

You should see something like this:

● jenkins.service - LSB: Start Jenkins at boot time
     Loaded: loaded (/etc/init.d/jenkins; generated)
     Active: active (exited) since Thu 2020-07-16 20:22:12 UTC; 15min ago
...

Adjusting Firewall #

If you are installing Jenkins on a remote Ubuntu server that is protected by a firewall , you’ll need to open port 8080.

Typically, you would want to allow access to the Jenkins server only from a specific IP address or IP range. For example, to allow connections only from the “192.168.121.0/24” subnet, you would run the following command:

sudo ufw allow proto tcp from 192.168.121.0/24 to any port 8080

If you need to allow access from anywhere run:

sudo ufw allow 8080

Setting Up Jenkins #

To set up your new Jenkins installation, open your browser, type your domain or IP address followed by port 8080, http://your_ip_or_domain:8080.

A page similar to the following will be displayed, prompting you to enter the Administrator password that is created during the installation:

Use cat to display the password on the terminal:

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

You should see a 32-character long alphanumeric password, as shown below:

06cbf25d811a424bb236c76fd6e04c47

Copy the password from the terminal, paste it into the “Administrator password” field and click “Continue”.

On the next screen, the setup wizard will ask you whether you want to install suggested plugins or you want to select specific plugins.

Click on the “Install suggested plugins” box and the installation process will start immediately.

Once the plugins are installed, you will be prompted to set up the first admin user. Fill out all required information and click “Save and Continue”.

The next page will ask you to set the URL for your Jenkins instance. The field will be populated with an automatically generated URL.

Confirm the URL by clicking on the Save and Finish button, and the setup process will be completed.

Click on the Start using Jenkins button, and you will be redirected to the Jenkins dashboard logged in as the admin user you have created in one of the previous steps.

At this point, you’ve successfully installed Jenkins on your server.

Conclusion #

In this tutorial, we have shown you how to install and complete the initial configuration of Jenkins on Ubuntu systems.

You can now visit the official Jenkins documentation page and start exploring Jenkins’s workflow and plug-in model.

If you have any questions, please leave a comment below.

jenkins ubuntu devops

Related

Tags: devops, jenkins, ubuntu

How to Install TeamViewer on Ubuntu 20.04

Prev Post

How to Install Elasticsearch on Debian 10

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 3
  • 639
  • 1,055,411

DesignLinux.com © All rights reserved

Go to mobile version