Jenkins is a powerful open-source automation server used for building, deploying, and automating projects. This guide will walk you through the steps to install Jenkins on an Ubuntu 22.04 server.

Step 1: Deploying a Cloud Instance on Shape.host

  • Log in to Shape.host Dashboard:
  • Navigate to the Shape.host website and log in to your account.
  • Create a New Instance:
  • Click on the “Create” button located at the top right corner of the dashboard.
  • From the dropdown menu, select “Instances”.
Shape.host Resources dashboard showing the Create menu and instance rebuild controls.
  • Select Instance Location:
  • Choose the desired location for your server. For this tutorial, we’ll select “New York, USA”.
Shape.host Create New Instance form with the available data center locations.
  • Choose a Plan:
  • Select a plan that fits your requirements. For example, you might choose a plan with 2 cores CPU, 2 GB Memory, and 50 GB SSD disk space.
  • Select an Operating System:
  • Scroll down to the “Choose an image” section and select “Ubuntu 22.04”.
Shape.host instance form with a server plan and Ubuntu image selected.
  • Configure Additional Options:
  • (Optional) You can configure additional options like User Data Configuration and IPv6 Networking.
  • Enter a hostname for your instance, e.g., “Tutorial Ubuntu”.
  • Click on the “Create instance” button to deploy the instance.
Shape.host instance form showing hostname, instance count and the Create Instance button.

Step 2: Connecting to Your Instance

  • Retrieve SSH Credentials:
  • Note the IP address of your newly created instance from the Shape.host dashboard.
  • Connect via SSH:
  • Open a terminal on your local machine.
  • Use the following command to connect to your instance:
    ssh root@your_instance_ip
  • Replace your_instance_ip with the actual IP address of your instance.

Step 3: Update System Packages

Ensure your system is up to date:

apt update
apt upgrade -y
Terminal showing APT package management commands and output.

Step 4: Install Java 17

Jenkins requires Java. Install OpenJDK 17:

apt install openjdk-17-jdk -y
Terminal showing APT package management commands and output.

Verify the Java installation:

java -version
Terminal showing java commands or output during Install Java 17.

You should see output indicating that Java 17 is installed.

Step 5: Add Jenkins Repository

Add the Jenkins repository key and repository entry:

wget -O /usr/share/keyrings/jenkins-keyring.asc https://pkg.jenkins.io/debian/jenkins.io-2023.key
echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian binary/" | tee /etc/apt/sources.list.d/jenkins.list > /dev/null
Terminal showing wget commands or output during Add Jenkins Repository.

Step 6: Install Jenkins

Update your package list and install Jenkins:

apt update
apt install jenkins -y
Terminal showing APT package management commands and output.

Step 7: Start and Enable Jenkins

Start Jenkins and enable it to start on boot:

systemctl start jenkins
systemctl enable jenkins
Terminal showing systemd service management commands or output.

Step 8: Troubleshooting Jenkins Startup

If Jenkins fails to start, check the service status:

systemctl status jenkins.service

Review detailed logs:

journalctl -xeu jenkins.service

Check Jenkins log file for specific error messages:

less /var/log/jenkins/jenkins.log

Step 9: Configure Firewall

Allow traffic on port 8080 (Jenkins default port) and SSH:

ufw allow 8080
ufw allow ssh
ufw enable
Terminal showing firewall configuration commands and rules.

Step 10: Set Up Jenkins

Open your web browser and navigate to http://your_server_ip_or_domain:8080. Enter the initial admin password:

Jenkins initial unlock screen requesting the administrator password.
cat /var/lib/jenkins/secrets/initialAdminPassword
Terminal showing cat commands or output during Set Up Jenkins.

Follow the setup wizard to complete the Jenkins installation.

By following these steps, you will have successfully installed and set up Jenkins on your Ubuntu 22.04 server.

Shape.host provides high-performance Linux SSD VPS hosting solutions. Their reliable infrastructure and excellent support ensure your applications run smoothly and securely. Explore Shape.host Cloud VPS options to scale your projects efficiently.