In this tutorial, we'll learn how to install Jenkins on Debian 13 server.
Below is a comprehensive, step-by-step guide to getting Jenkins up and running on a Linux system. Follow these steps to install, configure, and kickstart your CI/CD pipeline automation with Jenkins. You can use this guide as a reference on your blog to help your readers automate their build, test, and deployment processes.
Prerequisites:
- A Debian 13 installed dedicated server or KVM VPS.
- A root user or normal user with administrative privileges.
How to Install Jenkins on Debian 13
Step 1: Prepare Your Linux Environment
Before installing Jenkins, ensure your Linux system is up to date and has the necessary prerequisites installed. Most tutorials assume you’re running a Debian-based distribution (like Debian 13), but the steps are similar for other distributions with minor adjustments.
Update your system packages:
sudo apt update && sudo apt upgrade -y
Install essential packages:
These might include tools like wget or curl that you’ll need to download repository keys and files.
sudo apt install wget curl -y
Explanation:
Keeping your system updated minimizes conflicts and ensures compatibility. Tools like wget and curl help retrieve files from the internet during installation.
Step 2: Install Java
Jenkins is a Java-based application, so you’ll need to have Java installed. The recommended version is OpenJDK 11 or later.
Install OpenJDK 21:
sudo apt install openjdk-21-jdk -y
Verify the installation:
java -version
Explanation:
Java is the runtime for Jenkins. Verifying the installation confirms that Java is available and correctly set up on your system, which is critical before moving on.
Step 3: Add the Jenkins Repository and Key
To ensure you install the latest stable version of Jenkins, add the official Jenkins repository to your system.
Add the repository key:
curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo gpg --dearmor -o /usr/share/keyrings/jenkins-keyring.gpg
Append the Jenkins repository to your package sources:
echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.gpg] https://pkg.jenkins.io/debian binary/" | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null
Update package lists again to include the Jenkins repository:
sudo apt update
Step 4: Install Jenkins
With the repository in place, you can now install Jenkins using your system’s package manager.
Install Jenkins:
sudo apt install jenkins -y
The package manager takes care of downloading and installing Jenkins along with any dependencies. This method is straightforward and leverages your distribution’s package management system.
Step 5: Start and Enable the Jenkins Service
Once installed, you need to start Jenkins and enable it to run on boot.
Start the Jenkins service:
sudo systemctl start jenkins
Enable Jenkins to start at boot:
sudo systemctl enable jenkins
Check the status of the Jenkins service:
sudo systemctl status jenkins
Explanation:
Starting the service initiates Jenkins, and enabling it ensures that it automatically runs after a system reboot. Checking the status helps you verify that Jenkins is running without errors.
Step 6: Configure the Firewall
By default, Jenkins runs on port 8080. Ensure that your firewall settings allow traffic on this port.
Allow port 8080 through UFW (if you’re using UFW):
sudo ufw allow 8080
sudo ufw reload
Explanation:
Configuring your firewall is essential for ensuring that external users (or your own access from different networks) can reach the Jenkins web interface securely.
Step 7: Access Jenkins and Perform Initial Setup
Now that Jenkins is installed and running, it’s time to access the web interface to complete the setup.
Open your web browser and navigate to:
http://your_server_ip:8080

Retrieve the initial admin password:
When you first access Jenkins, you’ll be prompted to unlock it using a temporary admin password. Retrieve this password by running:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Copy and paste the password into the setup screen:
This will unlock Jenkins and allow you to proceed with the configuration.
Install Recommended Plugins:
Jenkins will prompt you to install plugins. Choosing the “Install suggested plugins” option is recommended for beginners, as it provides a set of plugins that cover most common CI/CD needs.
Create your first admin user:
Follow the instructions to set up a new admin user account.
Explanation:
The initial setup is crucial as it configures the basic security and plugin ecosystem of Jenkins. Installing recommended plugins provides essential functionality out of the box, while creating an admin account secures your Jenkins instance.
Step 8. Install Nginx
On Debian 13:
sudo apt update
sudo apt install nginx -y
Start and enable it:
sudo systemctl start nginx
sudo systemctl enable nginx
Check:
systemctl status nginx
If this isn’t running, stop here and fix that first.
Configure firewall:
sudo ufw allow 80,443/tcp
Create Nginx site configuration for Jenkins.
sudo nano /etc/nginx/sites-available/jenkins
Paste this exact configuration:
server {
listen 80;
server_name jenkins.example.com;
access_log /var/log/nginx/jenkins.access.log;
error_log /var/log/nginx/jenkins.error.log;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 90;
}
}
Replace: jenkins.example.com with your real domain or server hostname.
Enable Jenkins site:
sudo ln -s /etc/nginx/sites-available/jenkins /etc/nginx/sites-enabled/
Test Nginx config:
sudo nginx -t
If it fails, do not reload. Fix the error first.
Reload Nginx:
sudo systemctl reload nginx
Save.
Step 9. (Strongly Recommended) Enable HTTPS with Let’s Encrypt
Once HTTP works, HTTPS is trivial.
Install certbot:
sudo apt install certbot python3-certbot-nginx -y
Run:
sudo certbot --nginx -d jenkins.example.com
Set auto-renewal. Verify renewal:
sudo certbot renew --dry-run
Jenkins must know it’s behind a proxy, otherwise redirects and plugins break.
Open Jenkins UI →
Manage Jenkins → System → Jenkins Location
Set:
Jenkins URL: https://jenkins.example.com
Step 10: Configure Jenkins for Your CI/CD Pipeline
With the basic setup complete, you can now start customizing Jenkins to suit your CI/CD needs.
Set Up Credentials:
Navigate to the “Credentials” section in Jenkins to add credentials for accessing your source control repositories or deployment servers. This ensures that Jenkins can securely interact with your code repositories and remote servers.
Create a New Job or Pipeline:
- Click on “New Item” from the Jenkins dashboard.
- Enter a name for your job and select “Pipeline” (or “Freestyle project” if you prefer a simpler setup).
- Click “OK” to proceed.
Configure Your Job:
For a pipeline job, you can either define your pipeline in the web editor or reference a Jenkinsfile stored in your repository. A basic example of a pipeline script might look like:
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building...'
// Add build commands here, e.g., Maven, Gradle, etc.
}
}
stage('Test') {
steps {
echo 'Testing...'
// Add test commands here, e.g., unit tests
}
}
stage('Deploy') {
steps {
echo 'Deploying...'
// Add deployment commands here, e.g., SSH commands, Docker deployment
}
}
}
}
Save and Run Your Job:
After configuring your pipeline script, save the job and click “Build Now” to run your pipeline.
Explanation:
Setting up credentials ensures secure access to your external systems, while creating a pipeline job is where you define the automation for building, testing, and deploying your application. The pipeline script provided is a basic template that you can expand according to your project’s requirements.
Step 11: Further Customization and Best Practices
As you become more comfortable with Jenkins, consider these additional steps for a robust CI/CD environment:
Install Additional Plugins:
Explore and install plugins that add capabilities like code analysis, notification integrations (Slack, email), and container support (Docker).
Set Up Automated Backups:
Regularly back up your Jenkins configurations and job data to prevent data loss.
Configure Build Nodes (Agents):
If your projects grow, set up additional agents (build nodes) to distribute the workload and reduce build times.
Secure Your Jenkins Instance:
Consider integrating Jenkins with LDAP/Active Directory for authentication, using HTTPS for secure connections, and regularly updating plugins and Jenkins itself.
Explanation:
Customization and best practices ensure that your Jenkins setup remains scalable, secure, and efficient as your project requirements evolve. These practices are essential for a production-grade CI/CD pipeline.
Conclusion
In this tutorial, we've learnt how to install Jenkins on Debian 13 server. By following these steps, you now have a fully functional Jenkins instance on your Linux system. You’ve learned how to install and configure Jenkins, set up the initial administration and security measures, and create a basic CI/CD pipeline that automates the build, test, and deployment processes. With Jenkins at the heart of your automation, your development workflow can become more efficient, allowing your team to focus on delivering quality code.
Feel free to expand on this guide by adding real-world examples, integrating additional tools, and sharing best practices to help your users take full advantage of Jenkins for continuous integration and continuous deployment. Happy automating!
