How to install Jenkins on Ubuntu 18.04

Introduction

Jenkins is an open source automation server that can automate the repetitive technical tasks involved in continuous integration and software delivery. Jenkins is Java-based and can be installed from the Ubuntu package or by downloading and running its Web Application Archive (WAR) file-the file is a collection of files that make up a complete Web application running on the server.

In this tutorial, you will install Jenkins by adding its Debian package repository, and use that repository to install packages with apt.

Preparation

To follow this tutorial, you need:

Students who don’t have a server can buy it from here, but I personally recommend you to use the free Tencent Cloud Developer Lab for experimentation, and then buy server.

Step 1-Install Jenkins

The Jenkins version included in the default Ubuntu package is usually after the latest available version of the project itself. To take advantage of the latest patches and features, you can install Jenkins using the package maintained by the project.

First, add the repository key to the system:

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

After adding the key, the system will return OK. Next, append the address of the Debian package repository to the server's sources.list:

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

When these two are in place, run update so that apt uses the new repository:

sudo apt update

Finally, install Jenkins and its dependencies:

sudo apt install jenkins

Now that Jenkins and its dependencies are in place, we will start the Jenkins server.

Step 2-Start Jenkins

Let's start Jenkins with systemctl:

sudo systemctl start jenkins

Since systemctl does not display output, you can use its status command to verify whether Jenkins has started successfully:

sudo systemctl status jenkins

If all goes well, the beginning of the output should show that the service is active and configured to start on boot:

● jenkins.service - LSB: Start Jenkins at boot time
 Loaded:loaded(/etc/init.d/jenkins; generated)
 Active:active(exited) since Mon 2018-07-0917:22:08 UTC; 6min ago
  Docs: man:systemd-sysv-generator(8)
 Tasks:0(limit:1153)
 CGroup:/system.slice/jenkins.service

Now that Jenkins is running, let's adjust the firewall rules so that we can access it from a web browser to complete the initial setup.

Step 3-Turn on the firewall

By default, Jenkins runs on port 8080, so let's use the ufw command to open that port:

sudo ufw allow 8080

Check the status of ufw to confirm the new rule:

sudo ufw status

You will see that traffic is allowed to be ported to port 8080 from anywhere:

Status: active
​
To                         Action      From
------------
OpenSSH                    ALLOW       Anywhere
8080      ALLOW       Anywhere
OpenSSH(v6)               ALLOW       Anywhere(v6)8080(v6)                  ALLOW       Anywhere(v6)

**Note: **If the firewall is inactive, the following command will allow OpenSSH and enable the firewall:

sudo ufw allow OpenSSH
sudo ufw enable

After installing Jenkins and configuring the firewall, we can complete the initial setup.

Step 4-Set up Jenkins

To set up and install, please use your server domain name or IP address http://your_server_ip_or_domain:8080 to access Jenkins' default port 8080:

You should see the Unlock Jenkins screen, which shows the location of the initial password:

In the terminal window, use the cat command to display the password:

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

Copy the 32-character alphanumeric password from the terminal and paste it into the Administrator Password field, then click Continue.

The next screen shows the option to install suggested plugins or select specific plugins:

We will click on the Install suggested plugins option and it will start the installation process immediately:

After the installation is complete, you will be prompted to set up the first administrative user. You can skip this step and continue to use the initial password we used above as admin, but we will take a moment to create the user.

**Note: **The default Jenkins server is not encrypted, so the data submitted using this form is not protected. When you are ready to use this installation, follow the guide How to configure Jenkins SSL with Nginx reverse proxy on Ubuntu 18.04. This will protect user credentials and information about the build transmitted through the web interface.

Enter the user's name and password:

You will see the "Instance Configuration" page, which will ask you to confirm the preferred URL of the Jenkins instance. Confirm the server's domain name or server's IP address:

After confirming the corresponding information, click "Save and Finish". You will see a confirmation page confirming "Jenkins is ready!":

Click Start with Jenkins to access the main Jenkins dashboard:

At this point, you have successfully completed the installation of Jenkins.

in conclusion

In this tutorial, you installed Jenkins using the software package provided by the project, started the server, opened the firewall, and created an administrative user. At this point, you can start exploring Jenkins.

After completing the exploration, if you decide to continue using Jenkins, please follow the guide How to configure Jenkins SSL with Nginx reverse proxy on Ubuntu 18.04 to protect your password and any sensitive system or product information. Sent between your computer and the server in plain text.

To learn more about installing Jenkins related tutorials, please go to [Tencent Cloud + Community] (https://cloud.tencent.com/developer?from=10680) to learn more.


Reference: "How To Install Jenkins on Ubuntu 18.04"

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 VirtualBox 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 Apache on Ubuntu 20.04
How to install Git on Ubuntu 20.04
How to install Node.js on Ubuntu 16.04
How to install MySQL on Ubuntu 20.04
How to install Vagrant 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 Memcached 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 Mailpile on Ubuntu 14.04
How to install Jenkins on CentOS 8
How to install PrestaShop on Ubuntu 16.04
How to install Skype on Ubuntu 20.04
How to install Python 3.8 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 Docker Compose on Ubuntu 18.04
How to install Ubuntu on Raspberry Pi
How to install Bacula Server on Ubuntu 14.04
How to install MySQL on Ubuntu 18.04 (linux)
How to install Ubuntu 19.10 on Raspberry Pi 4
How to install Apache Kafka on Ubuntu 18.04