Jenkins

How To Install and Use Jenkins on Ubuntu 24.04

Welcome back to the Greenhost.cloud blog! Today, we’ll walk you through the process of installing and using Jenkins on Ubuntu 24.04. Jenkins is a powerful automation server that helps developers automate tasks such as building, testing, and deploying applications. Whether you’re working on a personal project or a large-scale enterprise application, Jenkins can streamline your workflow and improve productivity.

Prerequisites

Before we dive into the installation process, ensure you have the following:

  1. Ubuntu 24.04 – Make sure your system is up to date.
  2. Sudo Privileges – You will need administrative access to install packages.
  3. Java Development Kit (JDK) – Jenkins requires Java to run. We’ll install OpenJDK during this tutorial.

Step 1: Update Your System

First, open your terminal and update your package list to ensure you have the latest information on available packages:

sudo apt update
sudo apt upgrade -y

Step 2: Install Java

Jenkins requires Java to function. You can install OpenJDK by running the following command:

sudo apt install openjdk-11-jdk -y

To verify the Java installation, check the Java version:

java -version

You should see output confirming that Java is installed.

Step 3: Add the Jenkins Repository

Next, add the Jenkins repository to your system. First, import the GPG key:

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

Then, add the Jenkins repository to your system’s sources list:

sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

Step 4: Install Jenkins

Now that the repository is added, update your package list again:

sudo apt update

Finally, install Jenkins with the following command:

sudo apt install jenkins -y

Step 5: Start and Enable Jenkins

After the installation is complete, start the Jenkins service:

sudo systemctl start jenkins

To ensure Jenkins starts automatically on boot, enable the service:

sudo systemctl enable jenkins

Step 6: Adjust Your Firewall

If you are using UFW (Uncomplicated Firewall), you need to allow traffic on port 8080 (the default Jenkins port):

sudo ufw allow 8080
sudo ufw status

Step 7: Access Jenkins

Open your web browser and navigate to http://your_server_ip:8080. You will be greeted by the Jenkins setup wizard.

Step 8: Unlock Jenkins

To unlock Jenkins, you need to retrieve the initial admin password. Run the following command to find the password:

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

Copy the password displayed in the terminal and paste it into the “Administrator password” field in your web browser.

Step 9: Customize Jenkins

Once you unlock Jenkins, you will be given the option to install suggested plugins or select specific plugins to install. For beginners, it’s usually best to go with the suggested plugins.

After the plugins are installed, you can create your first admin user or continue as the admin user. Follow the prompts to complete the setup.

Step 10: Configure Jenkins

Once the setup is complete, you’ll be directed to the Jenkins dashboard. From here, you can start creating jobs, pipelines, and configuring various settings according to your project needs.

Conclusion

Congratulations! You have successfully installed Jenkins on Ubuntu 24.04. Jenkins is now ready to help you automate your software development processes. As you explore its features, you may want to dive into Jenkins Pipelines, integration with version control systems, and various plugins that enhance its capabilities.

Feel free to leave comments or questions below. Happy building and deploying with Jenkins!

For more tutorials and resources, stay tuned to the Greenhost.cloud blog!