Setting Up Jenkins on Ubuntu 22.04 LTS

Introduction

Jenkins is an free and open-source automation server that helps automate various tasks related to building, testing, and deploying software applications. It provides a platform for continuous integration (CI) and continuous delivery (CD), allowing developers to automate the process of building, testing, and deploying code changes to production environments.

Jenkins enables teams to automate repetitive tasks in the software development lifecycle, such as compiling code, running tests, and deploying applications. It supports a wide range of programming languages and integrates with various tools and technologies commonly used in software development, such as version control systems (e.g., Git, Subversion), build tools (e.g., Maven, Gradle), testing frameworks, and deployment platforms.

Using Jenkins, developers can set up pipelines or workflows to define the steps and actions required to build, test, and deploy their applications. These pipelines can be configured to trigger automatically whenever changes are made to the code repository, ensuring that the application is continuously integrated and tested as new code is added.

Jenkins offers a web-based interface that allows users to configure and manage jobs, monitor build status, view logs, and analyze build results. It also provides extensive plugin support, allowing users to extend its functionality and integrate with other tools and services.

Overall, Jenkins simplifies and accelerates the software development process by automating repetitive tasks, improving collaboration among team members, and ensuring consistent and reliable builds and deployments.

System Requirements

The system requirements for a Jenkins server can vary depending on factors such as the size of the organization, the number of projects, and the expected workload. However, here are some general guidelines for the hardware and software requirements:

Hardware Requirements:

  • CPU: At least a dual-core processor, although a quad-core or higher is recommended for better performance.
  • RAM: Minimum 4 GB, but 8 GB or more is recommended for larger setups or heavy usage.
  • Storage: Sufficient disk space to store Jenkins installation, plugins, and build artifacts. At least 50 GB is recommended.

Software Requirements:

  • Operating System: Jenkins can run on various operating systems, including Windows, Linux, and macOS. Choose an OS that is compatible with your infrastructure and preferences.
  • Java Runtime Environment (JRE): Jenkins requires Java to run. Install a compatible version of Java, such as OpenJDK or Oracle JDK. Jenkins supports Java 8 or later, but it’s recommended to use the latest stable version.

Network Requirements:

  • Port Accessibility: Ensure that the necessary ports (default is 8080) are accessible for incoming network connections to the Jenkins server.
  • Outbound Internet Access: Jenkins often requires internet access to download plugins and dependencies. Make sure the server has outbound internet access if you plan to use these features.

It’s worth mentioning that these requirements are basic guidelines, and you may need to adjust them based on your specific needs and usage patterns. It’s also advisable to monitor the server’s performance over time and make any necessary adjustments as your usage increases or changes.

In this post, We will show you how to install and configure Jenkins Automation server on ubuntu 22.04 LTS machine.

Step 1: Update System Packages

Run the following command to update the package lists from the repositories:

To update the default repository:

sudo apt-get update

After updating the package lists, you can upgrade the installed packages to their latest versions by running the following command:

sudo apt-get upgrade -y

Step 2: Installing Java Development Kit (JDK)

We need to install JAVA 11 on Ubuntu 22.04 machine because Jenkins requires Java to run. You can install OpenJDK using the following command:

sudo apt-get install openjdk-11-jdk -y 

To verify JAVA installed version:

java --version

Step 3: Add Jenkins Key and Repository

We need to add the Jenkins repository key and repository by following the given command.

To add key:

echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
  https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
  /etc/apt/sources.list.d/jenkins.list > /dev/null

To add repository:

curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee \
  /usr/share/keyrings/jenkins-keyring.asc > /dev/null

Step 4: Installing Jenkins

Update System Packages Again:

sudo apt-get update

Install Jenkins:

sudo apt-get install jenkins -y

Step 5: Controlling Jenkins Service

We need to also control the Jenkins service to manage the Jenkins’s process, We can control the Jenkins process by using systemctl utility.

To get status:

sudo systemctl status jenkins

We should get Jenkins service up and running state.

Step 6: Access Jenkins Web Interface

By default Jenkins will work on port 8080 so that’s why we need to open the port 8080 in firewall rule and we can disable the firewall rule in order to access Jenkins from network.

Open a web browser and visit http://localhost:8080. If you are accessing the server remotely, replace localhost with the server’s IP address or hostname.

Step 7: Unlock Jenkins

To unlock Jenkins, you’ll need to retrieve the initial administrator password. Run the following command to display the password:

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

Step 8: Jenkins Plugin Installation

On this step we will get the plugins to install as per suggestion and manual selection, Install suggested plugins in recommended.

We will see that Jenkin’s plugin installation under process.

Step 9: Creating Admin User

We should get first admin user creating form where we can set our admin username, password, full name and email id, Put yours details.

Step 10: Configure Endpoint

We need to verify the IP address and domain with port 8080 and then click on Save and finish.

After this we should get the Jenkins is ready page and click on Start using Jenkins button to get Jenkins dashboard.

If everything is configured fine, We should get Jenkins’s dashboard like this.

Step 11: Jenkins Data & Logs Path

In a Jenkins installation, the data path and logs path may vary depending on the operating system and the specific configuration of the Jenkins server. Here are some common default paths for Jenkins data and logs:

Logs Path:

  • Linux: /var/log/jenkins
  • macOS: /var/log/jenkins
  • Windows: C:\Program Files\Jenkins\logs

Data Path:

  • Linux: /var/lib/jenkins
  • macOS: /Users/Shared/Jenkins
  • Windows: C:\Program Files\Jenkins

Please note that these paths are the default locations, but they can be customized during the Jenkins installation or configuration process. Additionally, some Jenkins installations may store the data and logs in different directories, so it’s always a good idea to check the Jenkins configuration or documentation for the exact paths on your system.

Conclusion

We have done successful installation of Jenkins is a significant milestone in setting up a robust and efficient continuous integration and continuous delivery (CI/CD) pipeline. By completing the installation process, you have gained access to a powerful automation tool that enables you to streamline software development and deployment processes.

Author

Setting Up Jenkins on Ubuntu 22.04 LTS

2 thoughts on “Setting Up Jenkins on Ubuntu 22.04 LTS

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top