How to set up Jenkins on Ubuntu 20.04

How to set up Jenkins on Ubuntu 20.04

Jenkins is an open source tool that monitors the performance of recurring tasks such as software development and cron jobs. It’s written in Java and is intended to test and report on isolated changes in a larger code base in real time. Jenkins is a Continuous Integration server, and using it to run your tests on a non-developer machine is the recommended practice.

So, on top of Continuous Integration, there’s Continuous Deployment and Delivery, where you’ll be able to run, quickly, and automatically deploy the latest version of your codebase following successful tests. Jenkins, we can claim, makes deployment a breeze and aids in development pace.

What is Jenkins?

Jenkins is an open-source automation server that is used to automate various aspects of software development, including building, testing, and deploying software. It is one of the most popular tools in the DevOps and Continuous Integration/Continuous Delivery (CI/CD) space, allowing developers to automate repetitive tasks and accelerate the software development process.

Jenkins can be configured to automatically build and test software projects in various languages, including Java, Python, Ruby, and others. It supports a wide range of plugins and integrations with other tools, allowing developers to customize and extend its functionality to meet their specific needs.

With Jenkins, developers can set up a pipeline that automates the entire software development process, from code commit to deployment, and receive feedback on the status of each stage of the pipeline. This helps teams to identify and fix issues more quickly, resulting in faster software delivery and improved quality.

Essential Requirements

Jenkins has no complicated requirements, but you must have adequate superuser capabilities to do some simple installation activities on your operating system, and your system must be up to date with the most recent packages. Jenkins also necessitates the installation of a basic web server. So, let’s get Jenkins installed on the Ubuntu 20.04 LTS operating system.

Update the system

Before installing any packages, use the following command to update your operating system.

$ apt update

Basic Web Server

Jenkins requires the basic web server to be installed on your system, thus if you don’t have any installed, run the following command to install the web server.

$ apt -y install nginx

This will be used to set up the Nginx web server. You can also choose to install other web servers if you are more comfortable with them.

Check the status of your Nginx web server’s services with the command below once it’s been installed.

$ service nginx status
* nginx is running

It signifies that ‘Nginx’ is up and running, so let’s go on to the next phase.

Java Installation

Now, using the apt-get package manager, install Java first. You’ll need to install an open source JAVA Version 7 implementation for this. Using the command below, you can easily accomplish this.

$ apt install openjdk-7-jdk

When you run the above command, it displays a list of other recommended and required packages for Java ‘openjdk’ installation. To continue with those packages, type ‘N’ or press ‘Y’ to leave the installer.

The Java installation will take a few minutes to complete. After that, execute the command below to see what version of Java is installed on your system.

$ java -version

Installation and Configuration of Jenkins

We’re now ready to set up ‘Jenkins.’ So, before installing Jenkins, we’ll need to add the key and source list to apt. To do so, use the terminal to run the following two commands.

$ wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
OK

After you’ve added the key, you’ll get the ‘OK’ status. Here is the command to execute to get the source list.

$ sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'

Before migrating to Jenkins, it needs to update ‘apt’s’ cache so that it can refresh the operating system’s repository for the most recent packages.

$ apt update

After your system has been updated, use the command below to install Jenkins, and then press the ‘Y’ key to complete the process.

$ apt install jenkins

The installation process will conclude with the daemon being started. The command below will display you the status of Jenkins service along with the running process ID. Jenkins runs with the user name ‘jenkin’ by default.

$ service jenkins status

If you need to edit Jenkins’ configurations to meet your needs, look for its configuration file in the ‘/etc/default/’ directory and make the necessary modifications.

$ vim /etc/default/Jenkins

Jenkins’ HTTP connector operates on port 8080 by default. Now it’s time to use your web browser’s graphical user interface.

Jenkins graphical user interface settings

Visit the following URL in your browser to learn how to use and configure Jenkins.

http://your-ip-address:8080

You’ll be amazed to see its welcome page, which allows you to customize the system’s various parameters.

001 1

To begin the required configurations, go to ‘Manage Jenkins’ and select the required parameter.

002 1

Jenkins Security Configuration

By configuring Jenkins global security parameters and then applying to save the changes, you may discourage misuse.

003 1

System Configurations for Jenkins

We’ll make a few adjustments to the global settings and paths for the Jenkins configurations to input the correct path to your JDK, Apache Ant, and Maven. These can also be installed automatically by Jenkins. Once you’ve completed your settings, click the Save button to save the changes you’ve made.

004 1

If you’re installing Java, make sure you’re logged into Oracle’s account before you save the modifications.

005 1

Jenkins Plugin Management

Jenkins Plugin Management will be used to add, remove, disable, and enable plugins that can extend Jenkins’ capability.

To install plugins in Jenkins, go to the ‘Manage Plugins’ page and type in the name of the plugin you want to use. Choose it from the drop-down menu and click the “Download and Install” button.

006

When the installation is complete and no jobs are running, select Restart Jenkins as shown below.

007

You will be redirected to the Jenkins Restart Page after selecting the Restart option; it will take some time to install the plugins you selected.

Follow us TwitterFacebookLinkedIn

Open Source Listing

Previous Post
Next Post

Leave a Reply