- Blog Categories
- Project Management
- Agile Management
- IT Service Management
- Cloud Computing
- Business Management
- Business Intelligence
- Quality Engineer
- Cyber Security
- Career
- Big Data
- Programming
- Most Popular Blogs
- PMP Exam Schedule for 2024: Check PMP Exam Date
- Top 60+ PMP Exam Questions and Answers for 2024
- PMP Cheat Sheet and PMP Formulas To Use in 2024
- What is PMP Process? A Complete List of 49 Processes of PMP
- Top 15+ Project Management Case Studies with Examples 2024
- Top Picks by Authors
- Top 170 Project Management Research Topics
- What is Effective Communication: Definition
- How to Create a Project Plan in Excel in 2024?
- PMP Certification Exam Eligibility in 2024 [A Complete Checklist]
- PMP Certification Fees - All Aspects of PMP Certification Fee
- Most Popular Blogs
- CSM vs PSM: Which Certification to Choose in 2024?
- How Much Does Scrum Master Certification Cost in 2024?
- CSPO vs PSPO Certification: What to Choose in 2024?
- 8 Best Scrum Master Certifications to Pursue in 2024
- Safe Agilist Exam: A Complete Study Guide 2024
- Top Picks by Authors
- SAFe vs Agile: Difference Between Scaled Agile and Agile
- Top 21 Scrum Best Practices for Efficient Agile Workflow
- 30 User Story Examples and Templates to Use in 2024
- State of Agile: Things You Need to Know
- Top 24 Career Benefits of a Certifed Scrum Master
- Most Popular Blogs
- ITIL Certification Cost in 2024 [Exam Fee & Other Expenses]
- Top 17 Required Skills for System Administrator in 2024
- How Effective Is Itil Certification for a Job Switch?
- IT Service Management (ITSM) Role and Responsibilities
- Top 25 Service Based Companies in India in 2024
- Top Picks by Authors
- What is Escalation Matrix & How Does It Work? [Types, Process]
- ITIL Service Operation: Phases, Functions, Best Practices
- 10 Best Facility Management Software in 2024
- What is Service Request Management in ITIL? Example, Steps, Tips
- An Introduction To ITIL® Exam
- Most Popular Blogs
- A Complete AWS Cheat Sheet: Important Topics Covered
- Top AWS Solution Architect Projects in 2024
- 15 Best Azure Certifications 2024: Which one to Choose?
- Top 22 Cloud Computing Project Ideas in 2024 [Source Code]
- How to Become an Azure Data Engineer? 2024 Roadmap
- Top Picks by Authors
- Top 40 IoT Project Ideas and Topics in 2024 [Source Code]
- The Future of AWS: Top Trends & Predictions in 2024
- AWS Solutions Architect vs AWS Developer [Key Differences]
- Top 20 Azure Data Engineering Projects in 2024 [Source Code]
- 25 Best Cloud Computing Tools in 2024
- Most Popular Blogs
- Company Analysis Report: Examples, Templates, Components
- 400 Trending Business Management Research Topics
- Business Analysis Body of Knowledge (BABOK): Guide
- ECBA Certification: Is it Worth it?
- How to Become Business Analyst in 2024? Step-by-Step
- Top Picks by Authors
- Top 20 Business Analytics Project in 2024 [With Source Code]
- ECBA Certification Cost Across Countries
- Top 9 Free Business Requirements Document (BRD) Templates
- Business Analyst Job Description in 2024 [Key Responsibility]
- Business Analysis Framework: Elements, Process, Techniques
- Most Popular Blogs
- Best Career options after BA [2024]
- Top Career Options after BCom to Know in 2024
- Top 10 Power Bi Books of 2024 [Beginners to Experienced]
- Power BI Skills in Demand: How to Stand Out in the Job Market
- Top 15 Power BI Project Ideas
- Top Picks by Authors
- 10 Limitations of Power BI: You Must Know in 2024
- Top 45 Career Options After BBA in 2024 [With Salary]
- Top Power BI Dashboard Templates of 2024
- What is Power BI Used For - Practical Applications Of Power BI
- SSRS Vs Power BI - What are the Key Differences?
- Most Popular Blogs
- Data Collection Plan For Six Sigma: How to Create One?
- Quality Engineer Resume for 2024 [Examples + Tips]
- 20 Best Quality Management Certifications That Pay Well in 2024
- Six Sigma in Operations Management [A Brief Introduction]
- Top Picks by Authors
- Six Sigma Green Belt vs PMP: What's the Difference
- Quality Management: Definition, Importance, Components
- Adding Green Belt Certifications to Your Resume
- Six Sigma Green Belt in Healthcare: Concepts, Benefits and Examples
- Most Popular Blogs
- Latest CISSP Exam Dumps of 2024 [Free CISSP Dumps]
- CISSP vs Security+ Certifications: Which is Best in 2024?
- Best CISSP Study Guides for 2024 + CISSP Study Plan
- How to Become an Ethical Hacker in 2024?
- Top Picks by Authors
- CISSP vs Master's Degree: Which One to Choose in 2024?
- CISSP Endorsement Process: Requirements & Example
- OSCP vs CISSP | Top Cybersecurity Certifications
- How to Pass the CISSP Exam on Your 1st Attempt in 2024?
- Most Popular Blogs
- Best Career options after BA [2024]
- Top Picks by Authors
- Top Career Options & Courses After 12th Commerce in 2024
- Recommended Blogs
- 30 Best Answers for Your 'Reason for Job Change' in 2024
- Recommended Blogs
- Time Management Skills: How it Affects your Career
- Most Popular Blogs
- Top 28 Big Data Companies to Know in 2024
- Top Picks by Authors
- Top Big Data Tools You Need to Know in 2024
- Most Popular Blogs
- Web Development Using PHP And MySQL
- Top Picks by Authors
- Top 30 Software Engineering Projects in 2024 [Source Code]
- More
- Tutorials
- Practise Tests
- Interview Questions
- Free Courses
- Agile & PMP Practice Tests
- Agile Testing
- Agile Scrum Practice Exam
- CAPM Practice Test
- PRINCE2 Foundation Exam
- PMP Practice Exam
- Cloud Related Practice Test
- Azure Infrastructure Solutions
- AWS Solutions Architect
- AWS Developer Associate
- IT Related Pratice Test
- ITIL Practice Test
- Devops Practice Test
- TOGAF® Practice Test
- Other Practice Test
- Oracle Primavera P6 V8
- MS Project Practice Test
- Project Management & Agile
- Project Management Interview Questions
- Release Train Engineer Interview Questions
- Agile Coach Interview Questions
- Scrum Interview Questions
- IT Project Manager Interview Questions
- Cloud & Data
- Azure Databricks Interview Questions
- AWS architect Interview Questions
- Cloud Computing Interview Questions
- AWS Interview Questions
- Kubernetes Interview Questions
- Web Development
- CSS3 Free Course with Certificates
- Basics of Spring Core and MVC
- Javascript Free Course with Certificate
- React Free Course with Certificate
- Node JS Free Certification Course
- Data Science
- Python Machine Learning Course
- Python for Data Science Free Course
- NLP Free Course with Certificate
- Data Analysis Using SQL
How to Install Jenkins on Ubuntu 22.04? [Step-by-Step Guide]
Updated on 17 May, 2021
17.78K+ views
• 11 min read
Table of Contents
- Prerequisites to Install Jenkins on Ubuntu 22.04
- How to Install Jenkins on Ubuntu?
- Step 1: Update the System
- Step 2: Install Java
- Step 3: Install Jenkins on Ubuntu
- Step 4: Start Jenkins
- Step 5: Opening the Firewall
- Step 6: Setting Up Jenkins
- Step 7: Creation of New Build Jobs in Jenkins:
- How to Uninstall Jenkins?
- Why Use Jenkins?
- Conclusion
Automation is the key to the quick delivery of software versions that are not only speedier but also flawless and bug free in the dynamic world of software development. The foundation of this automation is made up of technologies that facilitate the creation, testing, and implementation of code changes. Jenkins is the ideal technology to help you expedite your efforts if you're trying to streamline your software development cycle through continuous integration and delivery.
With the help of this post, I will provide a thorough walkthrough of how to install Jenkins on Ubuntu 22.04, covering everything from configuration to the necessary prerequisites for a smooth Jenkins setup on Ubuntu. Explore Jenkins' features and see how they can improve your development process.
Step to Install Jenkins on Ubuntu | Description |
1. Update & Upgrade: | Ensure your system is up-to-date: sudo apt update && sudo apt upgrade -y |
2. Install Java: | Install OpenJDK 11: sudo apt install openjdk-11-jdk -y |
3. Update Package Lists: | Update package lists to include the new repository: sudo apt update |
4. Install Jenkins: | Install Jenkins: sudo apt install jenkins -y |
5. Start Jenkins: | Start the Jenkins service: sudo systemctl start jenkins |
6. (Optional) Configure Firewall: | If needed, configure your firewall to allow access to the Jenkins port (default: 8080). |
7. Access Jenkins: | Open a web browser and navigate to http://localhost:8080 to complete the initial setup. |
Prerequisites to Install Jenkins on Ubuntu 22.04
The following are required to installing Jenkins on Ubuntu 22.04,
- Make sure your Ubuntu 22.04 machine is up and running, to verify that you are running Ubuntu 22.04, type the command cat /etc/os-release
- Jenkins runs on Java, so make sure you have JDK 11 installed.
- Make sure your machine has package managed installed such as apt to easily manage software packages.
A. Hardware Requirements:
- RAM- 4 GB (Recommended)
- Storage- more than 50 GB of Hard Disk Space (Recommended)
B. Software Requirements:
- Java: Jenkins runs on Java, so make sure you have JDK 11 installed.
- Web Browser: Any browser such as Google Chrome, Mozilla Firefox, Microsoft Edge.
- Make sure your machine has package managed installed such as apt to easily manage software packages.
- Make sure your Ubuntu 22.04 machine is up and running, to verify that you are running Ubuntu 22.04, type the command cat /etc/os-release. For help in the planning of production capability of a Jenkins installation on Ubuntu see Choosing the right hardware for Masters.
With these prerequisites in place, you will be ready to install Jenkins on your Ubuntu 22.04 machine. Elevate your skills with the KnowledgeHut DevOps Foundation Certification .
How to Install Jenkins on Ubuntu?
Here is a step by step procedure on how to install Jenkins in Ubuntu 22.04:
Step 1: Update the System
First, ensure that your package lists are up-to-date by running the following commands:
sudo apt update
sudo apt upgrade
Step 2: Install Java
For Java installation, we will use the version packaged with Ubuntu. To install the OpenJDK version of Java, begin by updating the apt package index:
Begin by updating the apt package index to ensure you fetch the latest information:
To check, please run the following command in the terminal:
- 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:
$ sudo apt update
$ sudo apt install openjdk-8-jdk
- 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!
Step 3: Install Jenkins on Ubuntu
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:
$ wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add
The device returns OK when the key is inserted.
2. Next, link the repository of Debian packages to the sources.list of the server:
$ sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
3. When both are in place, upgrade to apt to use the new repository:
$ sudo apt update
4. Install Jenkins:
$ sudo apt install jenkins
Now we're going to start the Jenkins server, as Jenkins and its dependencies are in place.
Step 4: Start Jenkins
1. You can start Jenkins using systemctl:
$ sudo systemctl start jenkins
2. As systemctl does not display performance, you can use the status command to check that Jenkins has successfully launched:
$ sudo systemctl status jenkins
If all went well, the start of the performance should demonstrate that the service is active and ready to boot:
Output:
jenkins.service - LSB: Start Jenkins at boot time
Loaded: loaded (/etc/init.d/jenkins; generated)
Active: active (exited) since Sat 2021-04-17 00:34:17 IST; 26s ago
Docs: man:systemd-sysv-generator(8)
Process: 17609 ExecStart=/etc/init.d/jenkins start (code=exited, status=0/SUCC
As Jenkins is running, so adjust the firewall rules to complete our further setup of Jenkins from the web browser.
Step 5: Opening the Firewall
1. Jenkins works by default on port 8080, so let's open the port with ufw:
$ sudo ufw allow 8080
2. Check ufw’s status:
$ sudo ufw status
You will see that traffic from anywhere is permitted to port 8080.
Output:
Status: active
To Action From
-- ------ ----
8000 ALLOW Anywhere
CUPS ALLOW Anywhere
27017 ALLOW Anywhere
27017 ALLOW 192.168.1.10
8080 ALLOW Anywhere
8000 (v6) ALLOW Anywhere (v6)
CUPS (v6) ALLOW Anywhere (v6)
27017 (v6) ALLOW Anywhere (v6)
8080 (v6) ALLOW Anywhere (v6)
3. If the firewall is inactive, the following commands will allow OpenSSH and turn it back on:
$ sudo ufw allow OpenSSH
$ sudo ufw enable
We can finish the initial configuration with Jenkins install in Ubuntu 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.
Step 6: Setting Up Jenkins
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:
$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
3. Copy the alphanumeric terminal 32-character password and paste into the Administrator Password field, then click Continue.
Output:
0aaaf00d9afe48e5b7f2a494d1881326
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.
Step 7: Creation of New Build Jobs in 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:
1. 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,
- Click on the “Add build Setup”
- Select "Execute Windows batch command".
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.
How to Uninstall Jenkins?
1. Initially, you need to stop the Jenkins service by executing the following command:
```sudo service jenkins stop```
2. Remove Jenkins using the following command:
```sudo apt-get remove --purge jenkins -y ```
The -y flag automatically confirms the removal By following these two steps, you can uninstall Jenkins from your Ubuntu machine, ensuring a clean removal of the software.
Additionally, you can remove the Jenkins packages using the following command:
```sudo apt-get remove --auto-remove jenkins```
3. Now, verify the status of the Jenkins service with the following command:
``` service jenkins status```
For detailed guides on installing Jenkins on various platforms such as Windows, Linux, Mac, and more, explore our comprehensive article covering step-by-step instructions and prerequisites.
Why Use Jenkins?
You need to consider continuous integration (CI) and continuous delivery (CD) to understand Jenkins:
- 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.
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).
Conclusion
In this article, I walked through the step-by-step process of how to install Jenkins on Ubuntu 22.04, providing you with a thorough understanding. Additionally, we explored the uninstallation procedure, ensuring a complete coverage of managing Jenkins on your Ubuntu machine. By following this installation of Jenkins in Ubuntu - detailed step, you are well equipped with the knowledge to effortlessly set up and customize Jenkins according to your requirements.
Whether you are a new or an experienced user, this article serves as a valuable resource to streamline the installation and removal processes, allowing you to tailor it to your needs on Ubuntu. If you're looking to deepen your DevOps knowledge, consider exploring the DevOps Foundation Certification offered by KnowledgeHut.
Frequently Asked Questions (FAQs)
1. Where does Jenkins install on Ubuntu?
Jenkins is commonly installed in the /var/lib/jenkins directory on Ubuntu, although alternative installation locations include /etc/jenkins and /usr/share/jenkins.
2. Are there any security considerations during Jenkins installation?
Yes, please make sure the following considerations are addressed when setting up Jenkins:
- Make sure you set up strong passwords for Jenkins when setting it up.
- Make sure you have firewall enabled and have only allowed access to port where Jenkins is listening.
- Regularly update plugins to take advantage of available security patches.
3. How do I access the Jenkins web interface after installation?
Once installation is complete, you can access the Jenkins UI by opening a web browser and navigating to http://<your-server-ip>:8080. Make sure you replace your server ip with your server IP.
4. Can I install Jenkins on Ubuntu without root access?
Generally, installation with the package managed requires root access, but if you don't have root access, you might need to work with your admin to install Jenkins and request for necessary permissions. Some limited installations or configurations might be possible without root access, but it depends on the specific requirements and restrictions of your system.