Jenkins on Ubuntu: Installation and Setup

Rohit Vishwakarma - Oct 30 - - Dev Community

Prerequisites:

  1. Jenkins requires Java to run.
  2. Make sure port 8080 (default Jenkins port) is open if you’re using a firewall.
sudo apt update
sudo apt install fontconfig openjdk-17-jre -y
Enter fullscreen mode Exit fullscreen mode

Create a jenkins script

vim jenkins.sh
Enter fullscreen mode Exit fullscreen mode
#!/bin/bash
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
          https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
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
sudo apt-get update
sudo apt-get install jenkins -y
Enter fullscreen mode Exit fullscreen mode

Add execution permission

chmod +x jenkins.sh
Enter fullscreen mode Exit fullscreen mode

Image description

Execute the script

./jenkins.sh
Enter fullscreen mode Exit fullscreen mode

Image description

If Jenkins fails to start because a port is in use, run sudo systemctl edit jenkins and add the following

[Service]
Environment="JENKINS_PORT=8081"
Enter fullscreen mode Exit fullscreen mode

Here, "8081" was chosen but you can put another port available.

Image description

Start Jenkins and enable it to run on boot:

sudo systemctl start jenkins
sudo systemctl enable jenkins
Enter fullscreen mode Exit fullscreen mode

Image description

Image description

Now, just hit the address with http://your_server_ip:8080
the page should appear as below

Image description

To get the initial password:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Enter fullscreen mode Exit fullscreen mode

Image description

Image description

You can select “Install suggested plugins” or customize as needed.
Image description
wait until the process is completed
Image description

Set up the admin user and password for Jenkins.
Image description

After setting up the user, you can configure instance details or skip to the main Jenkins dashboard.
Image description

Image description

Use the configured admin user credential to login
Image description

Image description

.
Terabox Video Player