How To install Jenkins on Ubuntu
Jenkins is a Java-built open-source Continuous integration (Ci) and CD platform. BASIcally, Jenkins builds software projects, checks and deploys them. This is one of the most practical programming tools you can master, and today we will show you how Jenkins is installed on Ubuntu 18.04. Use this powerful tool to activate your VPS server!
Jenkins is loved by teams of all sizes, for different language projects like Java, Ruby, Dot Net, PHP etc. Jenkins is a platform that is autonomous, and can be used on Windows, Linux or any other operating system.
You need to consider continuous integration (Ci) and continuous delivery (CD) to understand Jenkins:
Developers update the code regularly in the shared repository (such as GitHub or TFS). improvements made in the source code are made at the end of the day, making it difficult to identify the errors. So, Jenkins is used here.
Once a developer changes the repository, Jenkins will automatically enable the build and immediately warn you in the event of an error (Continuous integration Ci).
Skip to the next section if you have Java already installed on your system.
To check, please run the following command in the terminal:
The default Ubuntu packages for Jenkins are always behind the current version of the project itself. You may use the project-maintained packages to install Jenkins to take advantage of the newest patches and features.
1. add the framework repository key:
The device returns OK when the key is inserted.
2. Next, link the repository of Debian packages to the sources.list of the server:
3. When both are in place, upgrade to apt to use the new repository:
4. install Jenkins:
Now we’re going to start the Jenkins server, as Jenkins and its dependencies are in place.
1. You can start Jenkins using systemctl:
2. As systemctl does not display performance, you can use the status command to check that Jenkins has successfully launched:
if all went well, the start of the performance should demonstrate that the service is active and ready to boot:
As Jenkins is running, so adjust the firewall rules to complete our further setup of Jenkins from the web browser.
1. Jenkins works by default on port 8080, so let’s open the port with ufw:
2. Check ufw’s status:
You will see that traffic from anywhere is permitted to port 8080.
3. if the firewall is inactive, the following commands will allow OpenSSH and turn it back on:
We can finish the initial configuration with Jenkins installed and our firewall configured.
Note: if you decide to continue to use Jenkins, use a Nginx Reverse Proxy at Ubuntu 18.04 to configure Jenkins with SSL when your exploration has been completed to protect your passwords and any sensitive system or product information sent between the machine and the server in plain text.
1. To set up installation, visit Jenkins on its default 8080 port with your server domain name or iP address: http://your_server_ip_or_domain:8080
You should see the Unlock Jenkins screen, which displays the initial password’s location:
2. You can use the cat command to display the password:
3. Copy the alphanumeric terminal 32-character password and paste into the Administrator Password field, then click Continue.
The following screen shows the ability to install or select certain plugins:
4. We will click on the option to install proposed plugins to start the installation process immediately.
5. When the installation is done, the first administrative user will be prompted. You can save this step and use your initial password to continue as an Admin. However, we will take some time to create the user.
The Jenkins default server is NOT encrypted to prevent data from being protected. Use the Nginx Reverse Proxy on Ubuntu 18.04 to configure Jenkins with SSL. This protects the information of users and builds transmitted through the web interface.
6. You will see a configuration instance page, which asks you to confirm your Jenkins instance’s URL of choice. Confirm either your server’s domain name or the iP address of your server.
7. Click Save and Finish once you have confirmed the relevant information. A confirmation page will show you that “Jenkins is ready!”
Hit Start using Jenkins button and it will take you to the Jenkins dashboard.
Congratulations! You have completed the installation of Jenkins.
The freestyle job is a highly versatile and user-friendly choice. it’s easy to set up and many of its options appear in many other build jobs. For all projects, you can use it.
Follow the following steps:
You have to login to your Jenkins Dashboard by visiting
2) Create New item:
Click on the New item on the left-hand side of the dashboard.
3) Fill the project description:
You can enter the job details as per your need.
4) Source Code Management:
Under source code management, enter the repository URL.
You can also use a Local repository.
5) Build environment:
Now in the Build section,
Now, add the java commands. in this article, we have used javac HelloWorld.java and java HelloWorld.
6) Save the project:
Click Apply and save the project.
7) Build Source Code and check its status:
Click on “Build Now” on the left-hand side of the screen to create the source code.
8) Console Output:
Select the build number and click on “Console Output” to check the status of the build run.
When it shows success, it means that we have successfully run the HelloWorld program from the cGitHub Repository.
in case of failure, you can check the job logs by clicking on failure icon and debug the root cause.
Follow the instructions to uninstall Jenkins:
$ sudo apt-get remove jenkins
$ sudo apt-get remove –auto-remove jenkins
Purging your data:
or you can use:
installing Jenkins on Ubuntu is really that easy. Jenkins has a low learning curve and so you can start to work with it as quickly as possible.
in the above article we have learned how to install Jenkins in an Ubuntu machine where all the steps are explained clearly. in case you want to learn more about the core concepts of Jenkins Jobs, Pipelines, Distributed System, Plugins, and how to use Jenkins in depth you can enroll for our course Jenkins Certification Course.
RAM- 4 GB (Recommended)
Storage- more than 50 GB of Hard Disk space (Recommended)
- RAM- 4 GB (Recommended)
- Storage- more than 50 GB of Hard Disk space (Recommended)
Java: Java Development kit (JDK) or Java Runtime environment (JRE).
Web Browser: Any browser such as Google Chrome, Mozilla Firefox, Microsoft Edge.
Operating System: An Ubuntu 18.04 server installed with a non-root sudo user and firewall. For help in the planning of production capability of a Jenkins installation see Choosing the right hardware for Masters.
Continuous integration – the practice of continuous production combined with the main industry.
Continuous delivery – the code is constantly delivered to an area after the code is ready for delivery. it could be for production or staging. The commodity is supplied to a consumer base that can provide QA or inspection by customers.
Jenkins needs Java for running, but it doesn’t include certain distributions by default, and Java versions of Jenkins are incompatible.
Multiple Java implementations are available to you. OpenJDK is currently the most popular one, which we will use in this guide.
Being an open-source Java application, Jenkins requires the installation of OpenJDK 8 on your system. The apt repositories can directly access OpenJDK 8.
The installation of OpenJDK from standard repositories is recommended. Open and enter the following in the terminal window:
The download and installation will be requested. Press the “Y” button and press the enter button to finish the process.
Java 8 will be installed on your system. We are ready to download Jenkins package now as we have our requirements ready!
Click on the “Add build Setup”
Select “Execute Windows batch command“.
- Java: Java Development kit (JDK) or Java Runtime environment (JRE).
- Web Browser: Any browser such as Google Chrome, Mozilla Firefox, Microsoft Edge.
- Operating System: An Ubuntu 18.04 server installed with a non-root sudo user and firewall. For help in the planning of production capability of a Jenkins installation see Choosing the right hardware for Masters.