TechTorch

Location:HOME > Technology > content

Technology

Guide to Installing Jenkins on Ubuntu: Step-by-Step Instructions

February 02, 2025Technology1853
Guide to Installing Jenkins on Ubuntu: Step-by-Step Instructions Setti

Guide to Installing Jenkins on Ubuntu: Step-by-Step Instructions

Setting up Jenkins on an Ubuntu system is a straightforward process that involves a few simple commands. Whether you are new to Jenkins or looking to optimize your existing setup, this guide will walk you through the installation process.

Understanding Jenkins on Ubuntu

Jenkins is an open-source automation server widely used for continuous integration and continuous delivery (CI/CD) pipelines. It is particularly popular on Ubuntu due to its user-friendly interface and extensive plugin ecosystem. By utilizing Jenkins, you can automate various tasks such as building, testing, and deploying your applications.

Installing Jenkins on Ubuntu

Method 1: Using Official Debian Repository

One of the most straightforward ways to install Jenkins on Ubuntu is by utilizing the official Debian repository. This method ensures you are installing a version that is regularly updated and maintained by the developers.

Update your package index:

sudo apt update

Install Java:

sudo apt install fontconfig openjdk-17-jre -y

Download Jenkins installation package:

sudo wget -O 

Add Jenkins GPG key:

echo deb [signed-by] Deb  binary/ | sudo tee  > /dev/null

Update package index again:

sudo apt-get update

Install Jenkins:

sudo apt-get install jenkins -y

Start Jenkins service:

sudo systemctl start jenkins

Check Jenkins status:

sudo systemctl status jenkins

Method 2: Using Manual Installation Steps

For a custom installation or when dealing with a specific environment, you can follow these manual steps.

Update your package index:

sudo apt update

Install Java:

sudo apt install openjdk-8-jdk

Download Jenkins public key:

wget -q -O -  | sudo apt-key add -

Add Jenkins repository:

echo deb  binary/ | sudo tee  > /dev/null

Install Jenkins:

sudo apt updatesudo apt install jenkins

Start Jenkins service:

sudo systemctl start jenkins

Check Jenkins status:

sudo systemctl status jenkins

Allow Jenkins port:

sudo ufw allow 8080

Access Jenkins:

http://ip_address_or_domain_name:8080

Retrieve initial admin password:

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

Create an account:

Enter the initial admin password and create an account.

Additional Steps for Full Functionality

To ensure full functionality, you might want to perform some additional configurations such as securing Jenkins or customizing its environment.

Securing Jenkins

Once you access Jenkins, you might want to secure it by configuring security settings, setting up password policies, and enabling two-factor authentication (2FA).

Customizing Jenkins

Customizing Jenkins involves adding plugins, configuring global settings, and setting up job templates to suit your development needs.

Resources for Further Learning

An excellent video guide on installing Jenkins on Ubuntu:

How to Install Jenkins on Ubuntu Linux Ubuntu 16.04 Ubuntu 18.04

The official Jenkins installation guide:

Installing Jenkins

Conclusion

Installing Jenkins on Ubuntu can significantly enhance your development workflow. By following the steps outlined in this guide, you can have a fully functional Jenkins instance up and running in no time. Remember, customizing your Jenkins setup to meet your specific needs is crucial for achieving the best results.