Installation

chevron-rightUbuntu 22/24hashtag

Before installing any packages, ensure your system is up to date

sudo apt update
sudo apt upgrade -y

Jenkins requires Java to run. Jenkinsarrow-up-right currently supports Java 11. Install the OpenJDK 11 package: (If java installed neglect the below this step)

sudo apt install openjdk-11-jdk -y

Verify the Java installationarrow-up-right by running:

java -version

Import Jenkins key to authenticate the repository:

curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee \

/usr/share/keyrings/jenkins-keyring.asc > /dev/null

Add Jenkins repository to your system's package list:

echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian-stable binary/ | sudo tee \

/etc/apt/sources.list.d/jenkins.list > /dev/null

Now that Jenkins' repository is added, update the package list again:

sudo apt update

Then install Jenkins:

sudo apt install jenkins -y

Once the installation is complete, start the Jenkins service:

sudo systemctl start jenkins

Enable the Jenkins service to start on boot:

sudo systemctl enable jenkins
  • Allow port 8080 through the firewall:

sudo ufw allow 8080
  • Reload the firewall to apply changes:

sudo ufw reload

To access Jenkins, open your web browser and enter your server's IP address or domain name, followed by port 8080:

http://your_server_ip_or_domain:8080

  • When you first access Jenkins, it will ask you for an admin password.

  • Retrieve the password by running this command:

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

  1. Click Install suggested plugins for a default setup.

  2. Wait while Jenkins installs the plugins.

Step 10: Create an Admin User

Once the plugins are installed, Jenkins will prompt you to create your first admin user.

  1. Fill in the required fields (username, password, etc.) to create the admin user.

  2. Click Save and Finish.

chevron-rightCentOS 7hashtag

Install Jenkins on CentOS 7

Step 1: Login and Switch to Root User

sudo su

Step 2: Install Required Dependencies

yum install -y wget epel-release

Step 3: Add the Jenkins Repository

wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo --no-check-certificate

Step 4: Import Jenkins Public Key

rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key

Step 5: Install Java (Required for Jenkins)

yum install -y java-11-openjdk-devel

Step 6: Install Jenkins

yum install -y jenkins

Step 7: Start and Enable Jenkins Service

systemctl start jenkins
systemctl enable jenkins

Step 8: Check Jenkins Status

systemctl status jenkins

Step 9: Retrieve Initial Admin Password

cat /var/lib/jenkins/secrets/initialAdminPassword

Reference:

Jenkins Official Documentation - Linux Installationarrow-up-right

Last updated