A Step-by-Step Guide to Installing Jenkins on Ubuntu
Introduction
Jenkins, an open-source automation server, has become a cornerstone in the world of continuous integration and continuous delivery (CI/CD). Its versatility and extensive plugin ecosystem make it a popular choice for automating the software development lifecycle. In this step-by-step guide, we’ll walk you through the process of installing Jenkins on an Ubuntu server, enabling you to kickstart your journey into efficient and automated software delivery.
Prerequisites:
Before we dive into the installation process, ensure that you have the following prerequisites in place:
- Ubuntu Server: Jenkins is platform-independent, but for this guide, we’ll focus on installing it on Ubuntu. You can choose a version that suits your needs, but we recommend using a Long Term Support (LTS) release.
- Java Runtime Environment (JRE): Jenkins requires Java to run. Install a compatible version of JRE on your Ubuntu server. You can use OpenJDK or Oracle JDK, depending on your preference.
Step 1: Update System Packages
Before installing any new software, it’s always a good practice to update your system’s package list. Open a terminal and run the following commands:
sudo apt update
sudo apt upgrade
Step 2: Install Java
As Jenkins is a Java-based application, you need to install Java on your server. You can use the following commands to install OpenJDK:
sudo apt install openjdk-11-jdk
Step 3: Add Jenkins Repository and Install
Next, you need to add the Jenkins repository to your system. Import the GPG keys and add the Jenkins repository with the following commands:
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
Now, update your package list and install Jenkins:
sudo apt update
sudo apt install jenkins
Step 4: Start and Enable Jenkins Service
Once the installation is complete, start the Jenkins service and enable it to start on boot:
sudo systemctl start jenkins
sudo systemctl enable jenkins
Step 5: Access Jenkins Web Interface
Jenkins runs on port 8080 by default. Open your web browser and navigate to http://your_server_ip:8080. You will be prompted to enter the initial administrator password.
Retrieve the password using the following command:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Paste the password into the Jenkins web interface, and follow the on-screen instructions to complete the setup.
Conclusion:
Congratulations! You have successfully installed Jenkins on your Ubuntu server. This powerful automation server opens up a world of possibilities for streamlining your software development pipeline. Explore Jenkins’ extensive plugin ecosystem and customize it to fit your specific needs, ushering in a new era of efficiency in your development workflow.