Installation of Jenkins on ubuntu

Ankita LunawatAnkita Lunawat
2 min read

Steps To install Jenkins on an Ubuntu system.

Update the System

update the system.

sudo apt update

Install Java

Jenkins requires Java to run, so you need to install OpenJDK.

sudo apt install openjdk-11-jdk -y

Verify the Java installation.

java -version

You should see an output like this

openjdk version "11.0.11" 2021-04-20

Add Jenkins Repository

Add the Jenkins repository key to your system.

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

Add the Jenkins repository to your sources list.

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

Now, update the package index again and install Jenkins.

sudo apt update
sudo apt install jenkins -y

Start and Enable Jenkins

Once Jenkins is installed, start the service and enable it to run at boot.

sudo systemctl start jenkins
sudo systemctl enable jenkins

Allow Jenkins Through Firewall (Optional)

If you're using a firewall (e.g., ufw), allow port 8080, which Jenkins uses by default.

sudo ufw allow 8080
sudo ufw reload

Access Jenkins

Jenkins runs on port 8080 by default; to access it, open a web browser and enter your server's IP address or domain name followed by :8080.

http://your_server_ip_or_domain:8080

Unlock Jenkins

When you first access Jenkins, it will prompt you for an Administrator Password, which you can retrieve using a specific command.

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

Copy the password, paste it into the Jenkins setup page, and continue with the setup.

Complete Jenkins Setup

  • Install the suggested plugins or select specific plugins based on your needs.

  • Create an admin user.

  • Finish the setup.

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

Hi there! I'm a passionate AWS DevOps Engineer with 2+ years of experience in building and managing scalable, reliable, and secure cloud infrastructure. I'm excited to share my knowledge and insights through this blog. Here, you'll find articles on: AWS Services: Deep dives into core AWS services like EC2, S3, Lambda, and more. DevOps Practices: Best practices for CI/CD, infrastructure as code, and automation. Security: Tips and tricks for securing your AWS environments. Serverless Computing: Building and deploying serverless applications. Troubleshooting: Common issues and solutions in AWS. I'm always eager to learn and grow, and I hope this blog can be a valuable resource for fellow DevOps enthusiasts. Feel free to connect with me on [LinkedIn/Twitter] or leave a comment below!