How to Install Jenkins CI/CD in Ubuntu Linux

choubertsprojects

VPN offers!

1. NordVPN

2. Surfshark

3. ExpressVPN

Jenkins CI/CD, or simply known as “continuous integration and continuous deployment” is a software project management tool that provides an easy-to-use interface for automating the build process of any kind of software project. Jenkins was originally created by Chris Wanstrath in 2004 but has since been adopted by IBM, Microsoft, Sony Interactive Entertainment America LLC, Twitter Inc., and more who have used it to automate their development environments. By using Jenkins CI/CD tools like on Ubuntu Linux you can easily configure your build environment with either Maven or Gradle builds on top of Bamboo’s job scheduler which would simplify your automation workflow
Category: Architecture & Design
Introduction: In this blog we will be covering some common pain points around designing websites within WordPress themes specifically designed for business sites ın order to help them maximize their return on investment (ROI). Our first pain point is how difficult it can be sometimes having multiple designers working together when they are not all experienced at the same things such as template design or typography. The second issue our team ran into while building out a new website was relocating internal links from one page to another without breaking anything else linking pages where needed based off what we were told before so if anyone reading finds themselves going through these struggles please let us know about them! We’ll offer solutions both suggestions and advice down below.
Topic: What Developing Platforms Should I Use?
Category: Technology That Help With Website Development And OptimizationTips To Improve Your ROIOn A Budget
Types Of Programming Languages For Websites Categories : PHP vs Ruby On Rails vs Python vs Laravel และ Others

The “package ‘jenkins’ has no installation candidate” is a message that appears when you try to install Jenkins CI/CD in Ubuntu Linux. This means that the Jenkins software cannot be installed on your system.

How to Install Jenkins CI/CD in Ubuntu Linux

Do you spend a lot of time in your infrastructure delivering code that involves a lot of processes and software? Don’t worry, you’ve come to the correct site if you want to learn how to install Jenkins, the most popular open-source program.

In this guide, you’ll learn how to install Jenkins on an Ubuntu system so that you can quickly generate and deploy code.

Continue reading and get started installing!

Prerequisites

This article will be a step-by-step guide. Make sure you have an Ubuntu computer to follow along. Ubuntu 18.04 with apache installed is used in this tutorial.

Related: [Step-by-Step] How to Install Ubuntu 20.04

Installing Java 11 on an Ubuntu Computer

Jenkins is a Continuous Integration (CI) and Continuous Deployment (CD) technology that may be used with a variety of servlet containers, including Apache Tomcat and Glassfish. For this demonstration, though, you’ll use Jenkins’ built-in Java servlet container server.

You may work with Jenkins using a variety of Java implementations, but the most common is OpenJDK, which you will install and use in this article.

1. Open your preferred SSH client and connect to your Ubuntu system.

2. Next, execute the following commands to create the /install jenkins demo directory and switch to it.

/install jenkins demo/mkdir cd /install jenkins demo /install jenkins demo /install jenkins demo /

3. To install Java on your system, use the apt install command.

Java SE 11 is the version to install (LTS) sudo apt-get install default-jdkdefault-jdkdefault-jdkdefault-jdk

Java SE 11 is the latest version that can be installed (LTS) Java SE 11 is the latest version that can be installed (LTS)

4. Finally, execute the command below to see what version of Java is installed on your system. This confirms that Java has been successfully installed.

# Verifying Java installation by checking the Java version. version of java

Verifying Java installation by checking the Java version Verifying Java installation by checking the Java version

Jenkins is being installed on an Ubuntu 18.04 LTS server.

Now that you’ve had Java installed on your Ubuntu laptop, it’s time to set up Jenkins. Jenkins is installed in a similar manner to other software on your computer.

Assuming you’re still using the SSH client, do the following:

1. First, update your system packages using the apt update command.

2. Then, to add the Jenkins public key to your machine, use the wget command.

The Jenkins site may now download the Jenkins official repository as well as any other needed packages after adding the public key.

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

3. To add the Jenkins official repository to your machine and update it, use the scripts below.

# Adding the Jenkins official repository to the system sudo sh -c ‘echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list’ # Updating the package sudo apt-get update

1647496771_795_How-to-Install-Jenkins-CICD-in-Ubuntu-Linux

4. Now, to install the Jenkins package, execute the command below.

# Jenkins Package Installation sudo apt-get install Jenkins

On an Ubuntu computer, installing the Jenkins package On an Ubuntu computer, installing the Jenkins package

5. Finally, execute the service command below to check the Jenkins service’s status. # Checking the status of the Jenkins service on an Ubuntu computer

# Checking the status of the Jenkins service on an Ubuntu computer

The Jenkins service is functioning, as you can see in the status below.

Jenkins service status is being checked. Jenkins service status is being checked.

Setting up a Jenkins Instance

You’ve made it halfway through the Jenkins installation process. However, before you can use it, you must first set it up with the essentials. How? The first step in configuring Jenkins is to unlock it once it has been installed.

Assuming you’re still using the SSH client, do the following:

1. Open your preferred browser and go to jenkins-ip:8080, which is the server’s IP address followed by port 8080. After clicking the link, you’ll need to enter the administrator password to unlock Jenkins. On the server, the administrator password is saved in the /var/lib/jenkins/secrets/initialAdminPassword directory (step two).

Jenkins Instance Unlocking Jenkins Instance Unlocking

2. Use the cat command to copy the administrator password from the /var/lib/jenkins/secrets/initialAdminPassword directory to your workstation.

initialAdminPassword = cat /var/lib/jenkins/secrets/initialAdminPassword

The big text in the output is the admin password, as you can see below. You’ll need the admin password to unlock Jenkins, so make a note of it (step three).

Checking the Admin Password for the First Time Checking the Admin Password for the First Time

3. Return to the Unlock Jenkins page in your web browser and input the admin password you recorded in step two.

Your browser will lead to a website where you may modify your Jenkins instance using plugins after you’ve activated Jenkins (step four).

4. Select the Install recommended plugins option on the Customize Jenkins page.

Jenkins Plugin is a third-party program that works with Jenkins to do tasks like the Git plugin. You may use the Git plugin to connect to a Git repository, perform Git commands, and so on.

Jenkins Plugin Installation Jenkins Plugin Installation

5. To create an Admin user, fill in the Admin user data as shown below, then click Save and Continue. You may use this Admin user to interact with Jenkins UI Dashboard or Jenkins instance.

When you click Save and Continue, you’ll be sent to the Instance Configuration page, which is seen in step five.

Jenkins creates an Admin account with username/password (admin: admin) by default, however you may still create an Admin user of your choosing. If you don’t want to establish a new Admin account, you may skip this step and proceed as admin.

The First Admin User is Created The First Admin User is Created

6. To save the instance setup, select Save and Finish.

You may provide the Jenkins URL you want to use in the instance setup, however in this case, you’ll use the default URL (i.e., server-ip:8080)

Jenkins Instance Configuration Jenkins Instance Configuration

Jenkins is up and running on port 8080. Jenkins is up and running on port 8080.

Changing the Default Port of a Jenkins Instance

You already know that Jenkins operates on port 8080 by default, which is good. But what if you need to run other apps like apache or NGINX on the same port? Don’t be concerned! You may modify Jenkins’ default port (8080) and run the Jenkins instance on a different port.

1. In your favourite text editor, open the /etc/default/Jenkins file and change the default port from 8080 to 9090, then save the changes.

Changing Jenkins's Default Port Changing Jenkins’s Default Port

2. Then, to ensure that the modified settings take effect, use the command below to restart Jenkins.

systemctl restart jenkins sudo

Controlling Systemd services using Ubuntu systemctl is a related topic.

3. Finally, return to the Jenkins URL but change the port to 9090, as shown below.

Jenkins is up and running on port 9090. Jenkins is up and running on port 9090.

Jenkins is running in a secure (HTTPS) mode with an SSL certificate.

Your Jenkins instance is now up and running on port 9090. Is it, however, safe? No, it isn’t. By using an SSL certificate, you can secure your Jenkins instance and prevent it from being hacked.

When no certificate from an external certifying authority is available, SSL certificates are mostly used to test on the local workstation.

To keep your Jenkins instance safe, follow these steps:

1. To store certificates, run each command below to create a directory called /certificates and go to that directory.

/certificates/mkdir cd /certificates /certificates /certificates /certificat

2. Then, to construct a Certificate Signing Request (CSR) and a private key, use the openssl command.

-x509 -newkey rsa:4096 -keyout apache.key -out apache.crt -days 365 -nodes openssl req -x509 -newkey rsa:4096 -keyout apache.key -out apache.crt -days 365 -nodes

Creating a certificate signing request (CSR) and a private key Creating a certificate signing request (CSR) and a private key

3. Execute the instructions below. Create a new directory (/etc/apache2/ssl) and copy the certificates from the /certificates/ directory.

mv /certificates/* /etc/apache2/ssl/ mkdir /etc/apache2/ssl/

4. Open the default SSL Apache site configuration file (/etc/apache2/sites-available/default-ssl.conf) and add the below lines. Be sure to replace <my-server-name> with your server’s actual name.

You give the (certificate key and file) location where you previously copied the SSL certificates in the code below. You’ll also need to add the ProxyPass argument and enable ProxyPreserveHost for Jenkins to redirect on port 9090.

ServerName <my-server-name> SSLCertificateFile /etc/apache2/ssl/apache.crt SSLCertificateKeyFile /etc/apache2/ssl/apache.key ProxyPreserveHost On ProxyPass / http://127.0.0.1:9090/ ProxyPassReverse / http://127.0.0.1:9090/

The default SSL Apache site configuration file is being updated. The default SSL Apache site configuration file is being updated.

5. Now execute each of the commands below to activate the SSL module, enable the site you updated (step four), and restart Apache.

# Enable the SSL module to function with encrypted connections. sudo a2enmod ssl proxy proxy http proxy balancer sudo a2enmod ssl proxy proxy http proxy balancer # Turn on the webpage you just changed (step four) a2ensite default-ssl.conf sudo # The Apache service must be restarted. service apache2 restart sudo

6. Finally, go to your Jenkins instance using HTTPS this time, as indicated below.

Jenkins is successfully opening with SSL connections on the HTTPS port, as you can see. If you notice a warning icon with the words “Not secure,” don’t be concerned. Because you’re utilizing a self-signed certificate (made by you) rather than a certificate issued by a certificate authority, you’ll see that warning.

Using SSL connections on the HTTPS port to connect to a Jenkins instance Using SSL connections on the HTTPS port to connect to a Jenkins instance

Conclusion

You learnt how to install Jenkins on an Ubuntu computer and test that you can safely access a Jenkins instance in this article.

How do you want to improve your game with Jenkins now? Is it possible to automate web deployments? Alternatively, why not build a Jenkins CI CD pipeline to help you enhance your software development process?

Create a Jenkins Build Job to Automate Web Deployments Related:Create a Jenkins Build Job to Automate Web Deployments

The “how to install jenkins in redhat linux” is a tutorial on how to install Jenkins CI/CD in Ubuntu Linux. This will allow you to use Jenkins with your build and test jobs.

Related Tags

  • the repository ‘https://pkg.jenkins.io/debian-stable binary/ release’ does not have a release file.
  • install jenkins on ubuntu 20
  • install java for jenkins ubuntu
  • how to start jenkins in linux