Install Jenkin Server

To install Jenkins on Ubuntu 22.04, follow these steps:


1. Update the System

Ensure your system is up to date by running:

sudo apt update
sudo apt upgrade -y

2. Install Java

Jenkins requires Java. Install OpenJDK 17 (recommended for Jenkins):

sudo apt install openjdk-17-jdk -y

Verify the installation:

java -version

3. Add Jenkins Repository

Jenkins is not in the default Ubuntu repositories. Add the official Jenkins repository:

  1. Import the GPG Key:
curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee \
  /usr/share/keyrings/jenkins-keyring.asc > /dev/null
  1. Add the Jenkins Repository:
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

4. Install Jenkins

After adding the repository, install Jenkins with the following:

sudo apt update
sudo apt install jenkins -y

5. Start and Enable Jenkins Service

Start the Jenkins service and enable it to run on boot:

sudo systemctl start jenkins
sudo systemctl enable jenkins

Verify the Jenkins service status:

sudo systemctl status jenkins

6. Open Firewall for Jenkins

By default, Jenkins runs on port 8080. Allow this port through the firewall:

sudo ufw allow 8080
sudo ufw reload

7. Access Jenkins

  1. Open your browser and navigate to: http://your_server_ip:8080 Replace your_server_ip with your server’s IP or localhost if accessing locally.
  2. Unlock Jenkins:
    • Run the following command to get the initial admin password: sudo cat /var/lib/jenkins/secrets/initialAdminPassword
    • Copy the password and paste it into the browser.
  3. Follow the on-screen instructions to complete the setup.

8. (Optional) Install Plugins and Configure Jenkins

  • During setup, you can choose to install Suggested Plugins or manually select plugins.
  • Create an admin user when prompted.

Jenkins should now be successfully installed and accessible! If you need further configuration or help, let me know.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top