Install Jenkins on Ubuntu

Ankita LunawatAnkita Lunawat
2 min read

Update the System

Update the package index on your Ubuntu system.

sudo apt update

Install Java

Jenkins requires Java to run. Install OpenJDK using the following command:

sudo apt install openjdk-11-jdk -y

You can verify the Java installation by checking the version.

java -version

Add Jenkins Repository

To install the latest stable Jenkins, you need to add the Jenkins repository to your system. Import the GPG key first.

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

Then add the Jenkins repository to your system:

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

Install Jenkins

Update your system again after adding the repository.

sudo apt update

Install Jenkins now

sudo apt install jenkins -y

Start and Enable Jenkins

Once installed, start the Jenkins service.

sudo systemctl start jenkins

Enable the Jenkins service to start automatically on system boot.

sudo systemctl enable jenkins

Adjust Firewall

If you are using a firewall, open port 8080 (the default Jenkins port) so Jenkins can be accessed.

sudo ufw allow 8080
sudo ufw reload

Access Jenkins

Jenkins runs on port 8080 by default. You can access it by visiting the following URL in your web browser.

http://your_server_ip_or_domain:8080

Unlock Jenkins

  1. When you first access Jenkins, you will be prompted to unlock it.

  2. To get the initial admin password and run.

     sudo cat /var/lib/jenkins/secrets/initialAdminPassword
    
  3. Copy the password and paste it into the Jenkins interface.

Install Suggested Plugins and Create Admin User

  1. Jenkins will prompt you to install suggested plugins. Click on Install suggested plugins.

  2. Once the installation completes, create an admin user.

That's it! Jenkins is now installed and running on your Ubuntu system.

0
Subscribe to my newsletter

Read articles from Ankita Lunawat directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ankita Lunawat
Ankita Lunawat

I am a dedicated and experienced Cloud Engineer with two years in the industry, specializing in designing, implementing, and managing scalable and secure cloud infrastructures. With a strong foundation in AWS, Azure, and GCP, I excel at leveraging cloud services to optimize performance, enhance security, and reduce operational costs. My expertise includes automated deployment pipelines, infrastructure as code (IaC) with tools like Terraform and container orchestration using Kubernetes and Docker. Throughout my career, I've collaborated with cross-functional teams to deliver robust cloud solutions, ensuring high availability and fault tolerance. I'm passionate about staying at the forefront of cloud technology trends and continuously enhancing my skill set to provide innovative solutions that drive business success. Whether it's migrating legacy systems to the cloud or architecting new cloud-native applications, I bring a strategic approach to every project, focusing on efficiency, scalability, and reliability. In addition to my technical skills, I am an advocate for DevOps practices, promoting a culture of collaboration and continuous improvement within development and operations teams. My commitment to learning and adapting to new technologies ensures that I can meet the evolving needs of any organization and deliver top-tier cloud solutions.