Introduction
Jenkins is one of the most popular open-source automation servers used for Continuous Integration (CI) and Continuous Deployment (CD). It helps development teams automate software building, testing, and deployment processes, improving productivity and reducing manual errors.
With Jenkins, organizations can streamline their DevOps workflows by automatically triggering builds, running tests, and deploying applications whenever code changes are pushed to a repository.
In this guide, we will walk through the complete process of installing Jenkins on an Ubuntu 16.04 server, configuring the required repository, starting the service, and completing the initial web-based setup.
Prerequisites
Before you begin, ensure you have the following:
- Ubuntu 16.04 server
- Root or sudo privileges
- Internet connectivity
- Port 8080 allowed through the firewall/security group
- System packages updated to the latest version
Step 1: Update the Ubuntu Server
Start by upgrading all installed packages to ensure the system is up to date.
sudo apt-get update
sudo apt-get upgrade -y
It is recommended to reboot the server after the upgrade if kernel updates are installed.
sudo reboot
Step 2: Add the Jenkins Repository Key
Jenkins packages are distributed through the official Jenkins repository. Add the Jenkins repository signing key to your server.
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
You should see:
OK
Step 3: Add the Jenkins Repository
Create a Jenkins repository source file and add the official stable repository.
echo "deb http://pkg.jenkins.io/debian-stable binary/" | sudo tee /etc/apt/sources.list.d/jenkins.list
Step 4: Refresh Package Information
Update the package cache so Ubuntu can retrieve packages from the newly added Jenkins repository.
sudo apt-get update
Step 5: Install Jenkins
Install Jenkins using the package manager.
sudo apt-get install jenkins -y
The installation process will automatically create the Jenkins service and required directories.
Step 6: Start and Enable Jenkins Service
Start the Jenkins service.
sudo systemctl start jenkins
Enable Jenkins to start automatically whenever the server reboots.
sudo systemctl enable jenkins
Verify that Jenkins is running successfully.
sudo systemctl status jenkins
Expected output:
Active: active (running)
Step 7: Access Jenkins Web Interface
Open a web browser and navigate to:
http://SERVER_IP:8080
Replace SERVER_IP with your server’s public IP address or hostname.
The Jenkins setup wizard will appear.
Step 8: Retrieve the Initial Administrator Password
Jenkins generates a temporary administrator password during installation.
Retrieve it using:
cat /var/lib/jenkins/secrets/initialAdminPassword
Example output:
d5a2f8d9b4c7e1f3a6...
Copy the password and paste it into the Jenkins setup screen.
Click Continue.
Step 9: Install Suggested Plugins
After unlocking Jenkins, you will be prompted to install plugins.
Select:
Install Suggested Plugins
Jenkins will automatically download and install the most commonly used plugins required for CI/CD pipelines.
This process may take several minutes depending on your internet connection.
Step 10: Create the First Administrator User
Once the plugins are installed:
- Enter a username.
- Set a strong password.
- Provide an email address.
- Click Save and Continue.
You can now log in using the credentials you created.
Step 11: Verify Jenkins Installation
After logging in, the Jenkins dashboard should be displayed successfully.
You can now:
- Create build jobs
- Configure CI/CD pipelines
- Connect Git repositories
- Install additional plugins
- Integrate with Docker and Kubernetes
- Automate deployments
Useful Jenkins Commands
Check Service Status
sudo systemctl status jenkins
Restart Jenkins
sudo systemctl restart jenkins
Stop Jenkins
sudo systemctl stop jenkins
View Jenkins Logs
sudo journalctl -u jenkins -f
Troubleshooting
Jenkins Not Accessible on Port 8080
Verify Jenkins is running:
sudo systemctl status jenkins
Check whether port 8080 is listening:
sudo netstat -tulpn | grep 8080
If a firewall is enabled, allow port 8080:
sudo ufw allow 8080/tcp
Unable to Retrieve Admin Password
Verify the Jenkins installation completed successfully:
sudo ls -l /var/lib/jenkins/secrets/
Then retry:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Conclusion
Installing Jenkins on Ubuntu 16.04 is a straightforward process that provides a powerful foundation for implementing Continuous Integration and Continuous Deployment practices. By following the steps outlined in this guide, you can quickly deploy Jenkins, secure the initial setup, and begin automating software delivery workflows.
Once Jenkins is operational, you can further enhance your DevOps environment by integrating source control platforms such as GitHub and GitLab, container platforms like Docker, and orchestration solutions such as Kubernetes. These integrations enable faster releases, improved code quality, and a more reliable deployment pipeline for modern applications.
Frequently Asked Questions (FAQ)
1. Why is Jenkins not accessible on port 8080?
If Jenkins is not accessible from your browser, ensure that the Jenkins service is running and that port 8080 is allowed through your firewall or cloud security group. You can verify the service status using:
sudo systemctl status jenkins
2. How do I retrieve the Jenkins initial administrator password?
After installation, Jenkins generates a temporary administrator password. You can retrieve it by running:
cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the password and use it to unlock the Jenkins setup wizard.
3. Can Jenkins be integrated with GitHub?
Yes. Jenkins can be integrated with GitHub to automatically trigger builds whenever code is pushed to a repository. This enables automated testing, building, and deployment as part of a CI/CD pipeline.

