How to install Jenkins on Ubuntu 20.04

Jenkins is the most popular, open source, Java-based automation server, which allows you to easily set up a continuous integration and continuous release pipeline.

Continuous Integration (CI) is a DevOps practice. When team members submit code to the version control warehouse normally, automated builds and tests are run. Continuous release (CD) is a series of practices. When the code is modified, it is automatically built, tested, and released to the production environment.

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

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

One, install Java

Jenkins is a Java application and requires Java 8 or later to be installed on the system. We will install OpenJDK 11, an open source implementation of the Java platform.

Run the following command as root or another sudo user to install OpenJDK 11:

sudo apt update
sudo apt install openjdk-11-jdk

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

java -version

The output should look 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)

Two, install Jenkins

Installing Jenkins on Ubuntu is relatively straightforward. We will enable the Jenkins APT software source, import the source GPGkey, and install the Jenkins package.

Use the following wget command to import the GPG keys of the Jenkins software source:

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

Next, add the software source to the system:

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

Once the Jenkins repositories are enabled, update the apt package list and install the latest version of Jenkins:

sudo apt update
sudo apt install jenkins
If you get any message like:
``` bash
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 key: ```bash
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9B7D32F2D50582E6

After the installation is complete, the Jenkins service will be automatically started. You can verify it by printing the service status:

systemctl status jenkins

You should see a message similar to the following:

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

Three, adjust firewall##

If you are installing Jenkins on a remote server and the server is protected by a firewall, you will need to open port 8080.

Usually, you will only allow access to the Jenkins server from the specified IP address or IP range. For example, to allow access from "192.168.121.0/24", you will need to run the following command:

sudo ufw allow proto tcp from192.168.121.0/24 to any port 8080

If you need to allow access from anywhere, run:

sudo ufw allow 8080

Fourth, set up Jenkins

To set up a new Jenkins installation, open your browser, enter your domain name or IP address, plus port 8080, http://your_ip_or_domain:8080.

A page similar to the following will be displayed, prompting you to enter the administrator password during the installation process:

Use cat to display the password in the terminal:

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

You should see a 32-character password, including letters and numbers, like this:

06 cbf25d811a424bb236c76fd6e04c47

Copy this password from the terminal, paste it into the "Administrator password" text field, and click "Continue".

On the next screen, the graphical interface will ask you whether you want to install the recommended plug-in, or if you choose the specified plug-in:

Click "Install suggested plugins" and the installation process will start immediately:

Once the plugin is installed, you will be prompted to set up the first administrator account. Fill in the necessary information and click "Save and Continue".

The next page will ask you to set the URL address of the Jenkins instance. This text field will be automatically filled in the generated URL.

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

Click the "Start using Jenkins" button and you will be redirected to the Jenkins backend and log in as the administrator user you created earlier.

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

Five, summary##

In this guide, we have shown you how to install Jenkins and complete the initial setup on an Ubuntu system.

You can now browse Jenkins official documentation, and start exploring the workflow and plug-in mode of Jenkins.

Original: https://linuxize.com/post/how-to-install-jenkins-on-ubuntu-20-04/

Copyright notice: This work uses Creative Commons attribution-Share 4 in the same way.0 International license agreement for licensing.

Recommended Posts

How to install Jenkins on Ubuntu 16.04
How to install Jenkins on Ubuntu 20.04
How to install Jenkins on Ubuntu 18.04
How to install Ruby on Ubuntu 20.04
How to install Memcached on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to install Elasticsearch on Ubuntu 20.04
How to install Protobuf 3 on Ubuntu
How to install Nginx on Ubuntu 20.04
How to install Node.js on Ubuntu 16.04
How to install MySQL on Ubuntu 20.04
How to install Jenkins on CentOS 8
How to install Bacula-Web on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 16.04
How to install Git on Ubuntu 20.04
How to install Anaconda3 on Ubuntu 18.04
How to install MemSQL on Ubuntu 14.04
How to install Go on Ubuntu 20.04
How to install MongoDB on Ubuntu 16.04
How to install Jenkins on CentOS 8
How to install PrestaShop on Ubuntu 16.04
How to install Python 3.8 on Ubuntu 18.04
How to install KVM on Ubuntu 18.04
How to install KVM on Ubuntu 20.04
How to install opencv3.0.0 on ubuntu14.04
How to install Anaconda on Ubuntu 20.04
How to install Prometheus on Ubuntu 16.04
How to install Apache on Ubuntu 20.04
How to install R on Ubuntu 20.04
How to install Moodle on Ubuntu 16.04
How to install Solr 5.2.1 on Ubuntu 14.04
How to install Teamviewer on Ubuntu 16.04
How to install MariaDB on Ubuntu 20.04
How to install Nginx on Ubuntu 20.04
How to install Mono on Ubuntu 20.04
How to install Go on Ubuntu 20.04
How to install Zoom on Ubuntu 20.04
How to install Nginx on Ubuntu 16.04
How to install OpenCV on Ubuntu 20.04
How to install Spotify on Ubuntu 20.04
How to install Postman on Ubuntu 18.04
How to install Go 1.6 on Ubuntu 16.04
How to install Go on Ubuntu 18.04
How to install MySQL on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 20.04
How to install VLC on Ubuntu 18.04
How to install TeamViewer on Ubuntu 20.04
How to install Webmin on Ubuntu 20.04
How to install Bacula Server on Ubuntu 14.04
How to install Ubuntu 19.10 on Raspberry Pi 4
How to install Apache Kafka on Ubuntu 18.04
How to install Apache Maven on Ubuntu 20.04
How to install Apache Tomcat 8 on Ubuntu 16.04
How to install Python2 on Ubuntu20.04 ubuntu/focal64
How to install GCC compiler on Ubuntu 18.04
How to install Graylog 1.x on Ubuntu 14.04.
How to install Zabbix on Ubuntu 16.04 Server
How to install Opera web browser on Ubuntu 18.04
How to install Prometheus with Docker on Ubuntu 14.04
How to install Visual Studio Code on Ubuntu 20.04