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”.
- Select Instance Location:
- Choose the desired location for your server. For this tutorial, we’ll select “New York, USA”.
- 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”.
- 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.
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
Step 4: Install Java 17
Jenkins requires Java. Install OpenJDK 17:
apt install openjdk-17-jdk -y
Verify the Java installation:
java -version
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
Step 6: Install Jenkins
Update your package list and install Jenkins:
apt update
apt install jenkins -y
Step 7: Start and Enable Jenkins
Start Jenkins and enable it to start on boot:
systemctl start jenkins
systemctl enable jenkins
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
Step 10: Set Up Jenkins
Open your web browser and navigate to http://your_server_ip_or_domain:8080
. Enter the initial admin password:
cat /var/lib/jenkins/secrets/initialAdminPassword
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.