How to Install Jenkins on Ubuntu 24.04

How to Install Jenkins on Ubuntu 24.04

Installing Jenkins on Ubuntu 24.04 is a straightforward process that involves a few key steps. Jenkins is a powerful automation server widely used for continuous integration and continuous delivery (CI/CD) pipelines. In this article, we'll walk you through the installation process step-by-step.

Prerequisites

Before we start, ensure you have:

- A running instance of Ubuntu 24.04

- Sudo privileges

Step-by-Step Installation

1. Update the Package List

First, update your package list to make sure you have the latest information about the newest versions of packages and their dependencies.

```bash

sudo apt update

```

2. Install Java

Jenkins requires Java to run. We'll install OpenJDK 17, which is compatible with Jenkins.

```bash

sudo apt install openjdk-17-jre-headless

```

Verify the Java installation:

```bash

java -version

```

You should see output indicating that Java is installed.

3. Add Jenkins Repository Key

Download and add the Jenkins repository key to your system.

```bash

wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo gpg --dearmor -o /usr/share/keyrings/jenkins.gpg

```

4. Add Jenkins Repository

Add the Jenkins repository to your system's package sources list.

```bash

sudo echo "deb [signed-by=/usr/share/keyrings/jenkins.gpg] https://pkg.jenkins.io/debian-stable binary/" | sudo tee /etc/apt/sources.list.d/jenkins.list

```

5. Troubleshooting Key Issues

If you encounter issues with the key, use the following command to add the key manually:

```bash

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <KEY>

```

6. Update the Package List Again

Update the package list again to include the Jenkins repository.

```bash

sudo apt update

```

7. Install Jenkins

Now, install Jenkins.

```bash

sudo apt install jenkins

```

8. Start Jenkins

Start the Jenkins service using systemctl.

```bash

sudo systemctl start jenkins

```

9. Verify Jenkins is Running

To ensure Jenkins is running, check the status of the Jenkins service.

```bash

sudo systemctl status jenkins

```

You should see output indicating that Jenkins is active and running.

10. Access Jenkins

Jenkins runs on port 8080 by default. Open your web browser and navigate to:

```

https://your_server_ip:8080

```

You will see the Jenkins setup wizard. The initial password can be found in the following file:

```bash

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

```

Copy the password, paste it into the setup wizard, and follow the on-screen instructions to complete the setup.

Conclusion

You've successfully installed Jenkins on Ubuntu 24.04! You can now start creating your CI/CD pipelines and automate your development processes. Jenkins is a versatile tool that can significantly enhance your workflow, and with its wide range of plugins, the possibilities are endless.

If you found this guide helpful, please share it with your network and feel free to reach out with any questions or comments. Happy building!

要查看或添加评论,请登录

社区洞察

其他会员也浏览了