Swiftorial Logo
Home
Swift Lessons
Matchups
CodeSnaps
Tutorials
Career
Resources

Installing Jenkins on Ubuntu

1. Introduction

Jenkins is an open-source automation server that enables developers to build, test, and deploy their software. This lesson will guide you through the installation of Jenkins on an Ubuntu system.

2. Prerequisites

Before You Begin

  • Ubuntu 18.04 or later installed.
  • Java Development Kit (JDK) installed (Jenkins requires Java).
  • Root or sudo access to the system.

3. Installation Steps

Step 1: Update Your System

First, ensure your package list is up to date:

sudo apt update

Step 2: Install Java

Jenkins requires Java to run. Install OpenJDK:

sudo apt install openjdk-11-jdk

Verify the installation:

java -version

Step 3: Add Jenkins Repository

Import the GPG key for the Jenkins repository:

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

Add the Jenkins repository to your system:

echo deb http://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list

Step 4: Install Jenkins

Update the package list again and install Jenkins:

sudo apt update
sudo apt install jenkins

Step 5: Start Jenkins

Start the Jenkins service:

sudo systemctl start jenkins

Enable Jenkins to start at boot:

sudo systemctl enable jenkins

Step 6: Check Jenkins Status

Verify that Jenkins is running:

sudo systemctl status jenkins

4. Post Installation Steps

Access Jenkins Web Interface

Open your web browser and go to:

http://your_server_ip:8080

You will be prompted to unlock Jenkins using a default password found in:

cat /var/lib/jenkins/secrets/initialAdminPassword

Copy the password and paste it into the browser to proceed with the setup.

5. FAQ

What is Jenkins?

Jenkins is an open-source automation server that helps automate the software development process.

Can I run Jenkins on a virtual machine?

Yes, Jenkins can run on a virtual machine as long as it has the necessary resources and network access.

How do I update Jenkins?

To update Jenkins, run sudo apt update and sudo apt upgrade jenkins.