The DevOps team at xFusionCorp Industries is initiating the setup of CI/CD pipelines and has decided to utilize Jenkins as their server. Execute the task according to the provided requirements:
- Install
Jenkinson the jenkins server using theaptutility only, and start it using theservicecommand. - If you face a timeout issue while starting the Jenkins service, first check the service status with
service jenkins status Then review the logs in
/var/log/jenkins/jenkins.logto identify the cause.Jenkin's admin user name should be
theadmin, password should beAdm!n321, full name should beRaviand email should beravi@jenkins.stratos.xfusioncorp.com.
Note:
- To access the
jenkinsserver, connect from the jump host using therootuser with the passwordS3curePass. - After Jenkins server installation, click the
Jenkinsbutton on the top bar to access the Jenkins UI and follow on-screen instructions to create an admin user.
Understanding Jenkins
What is Jenkins?
Jenkins is a Java-based automation server that facilitates continuous integration and continuous delivery (CI/CD). It provides hundreds of plugins to support building, deploying, and automating any project.
Why Use Jenkins?
| Feature | Benefit |
|---|---|
| Automation | Automates build, test, and deployment processes |
| Extensibility | Over 2,000 plugins available |
| Distributed Builds | Supports master-agent architecture |
| Integration | Works with Git, Docker, Kubernetes, and more |
| Open Source | Free to use with a large community |
What We Will Build
Task Overview
| Component | Specification |
|---|---|
| Server | Jenkins Server (Ubuntu 24.04) |
| Java Version | OpenJDK 21 |
| Jenkins Version | 2.568.3 |
| Port | 8080 |
| Admin User | theadmin |
| Password | Adm!n321 |
| Full Name | Ravi |
ravi@jenkins.stratos.xfusioncorp.com |
Architecture Diagram
┌─────────────────────────────────────────────────────────────────────────────┐
│ Jenkins Server (Ubuntu 24.04) │
│ │
│ ┌────────────────────────────────────────────────────────────────────────┐ │
│ │ Jenkins Installation │ │
│ │ - Installed via apt │ │
│ │ - Version: 2.568.3 │ │
│ │ - Port: 8080 │ │
│ └────────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌────────────────────────────────────────────────────────────────────────┐ │
│ │ Java Runtime Environment │ │
│ │ - OpenJDK 21 │ │
│ │ - Required for Jenkins to run │ │
│ └────────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌────────────────────────────────────────────────────────────────────────┐ │
│ │ Jenkins Configuration │ │
│ │ - Admin User: theadmin │ │
│ │ - Password: Adm!n321 │ │
│ │ - Full Name: Ravi │ │
│ │ - Email: ravi@jenkins.stratos.xfusioncorp.com │ │
│ └────────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ https://8080-port-u5auld5niwwzzrcr.labs.kodekloud.com │
└─────────────────────────────────────────────────────────────────────────────┘
SSH to Jenkins Server
# Connect from jump host
ssh root@jenkins
# Password: S3curePass
Update System Packages
apt update
apt upgrade -y
Install Java 21
Jenkins requires Java 21 or 25. Earlier versions like Java 11 will cause compatibility issues.
# Install Java 21
apt install -y openjdk-21-jdk
# Verify Java installation
java -version
Output:
openjdk version "21.0.12" 2026-07-21
OpenJDK Runtime Environment (build 21.0.12+8-1-24.04-Ubuntu)
OpenJDK 64-Bit Server VM (build 21.0.12+8-1-24.04-Ubuntu, mixed mode, sharing)
Remove Older Java Versions
If Java 11 is installed, remove it to avoid conflicts.
# Check installed Java versions
dpkg -l | grep -i jdk
# Remove Java 11
apt purge -y openjdk-11-*
# Verify Java 21 is still installed
java -version
Install Jenkins
Add the Jenkins repository and install the package.
# Add Jenkins repository key
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | apt-key add -
# Add Jenkins repository
echo "deb https://pkg.jenkins.io/debian-stable binary/" > /etc/apt/sources.list.d/jenkins.list
# Update package list
apt update
# Install Jenkins
apt install -y jenkins
Output:
Setting up jenkins (2.568.3) ...
Step 5: Start Jenkins Service
# Start Jenkins
service jenkins start
# Check status
service jenkins status
# Verify port 8080 is listening
netstat -tulpn | grep 8080
Output:
tcp6 0 0 :::8080 :::* LISTEN 5515/java
Retrieve Initial Admin Password
# Get the initial admin password
cat /var/lib/jenkins/secrets/initialAdminPassword
Output:
5da7d6a2ff9544e78d48dd55a36813ea
Access Jenkins UI
- Click the Jenkins button on the top bar
- Or access via browser:
https://8080-port-u5auld5niwwzzrcr.labs.kodekloud.com/ - Enter the initial admin password
Create Admin User
In the Jenkins UI setup wizard:
- Select Install suggested plugins
- Wait for plugin installation to complete
- Create the admin user with the following details:
-
Username:
theadmin -
Password:
Adm!n321 -
Full Name:
Ravi -
Email:
ravi@jenkins.stratos.xfusioncorp.com
-
Username:
- Click Save and Continue
- Set the Jenkins URL (keep default or use provided URL)
- Click Save and Finish
Verify Jenkins is Ready
Once the setup is complete, you will see the Jenkins dashboard:
Troubleshooting
Jenkins Fails to Start
# Check Jenkins logs
tail -50 /var/log/jenkins/jenkins.log
# Check Java version
java -version
# Start Jenkins manually
java -jar /usr/share/java/jenkins.war --httpPort=8080
Port 8080 Already in Use
# Check what is using port 8080
netstat -tulpn | grep 8080
# Kill the process
fuser -k 8080/tcp
# Start Jenkins again
service jenkins start
Missing Initial Admin Password
# The initial password is stored here
cat /var/lib/jenkins/secrets/initialAdminPassword
# If not found, check Jenkins logs
tail -50 /var/log/jenkins/jenkins.log | grep -i password
Java Version Incompatibility
# Check Jenkins logs for Java version errors
tail -50 /var/log/jenkins/jenkins.log
# Install correct Java version
apt install -y openjdk-21-jdk
# Verify default Java
update-alternatives --config java
Jenkins Configuration Files
| File | Purpose |
|---|---|
/etc/default/jenkins |
Main configuration (port, Java options) |
/var/lib/jenkins/ |
Jenkins home directory |
/var/log/jenkins/jenkins.log |
Jenkins logs |
/var/lib/jenkins/secrets/initialAdminPassword |
Initial admin password |
/usr/share/java/jenkins.war |
Jenkins WAR file |
Key Takeaways
1. Java Version Matters
Jenkins requires Java 21 or 25. Using an older version like Java 11 will prevent Jenkins from starting.
2. Initial Admin Password
The initial admin password is stored in /var/lib/jenkins/secrets/initialAdminPassword. This is required for the first login.
3. Service Management
On Ubuntu, Jenkins can be managed using the service command:
service jenkins start
service jenkins stop
service jenkins status
service jenkins restart
4. Port Configuration
Jenkins runs on port 8080 by default. This can be changed in /etc/default/jenkins by modifying the HTTP_PORT variable.
Useful Commands Reference
| Command | Purpose |
|---|---|
service jenkins start |
Start Jenkins |
service jenkins stop |
Stop Jenkins |
service jenkins status |
Check Jenkins status |
service jenkins restart |
Restart Jenkins |
cat /var/lib/jenkins/secrets/initialAdminPassword |
Get initial admin password |
tail -f /var/log/jenkins/jenkins.log |
View logs in real-time |
java -version |
Check Java version |
| `netstat -tulpn \ | grep 8080` |
apt install -y jenkins |
Install Jenkins |
apt purge -y openjdk-11-* |
Remove Java 11 |
Jenkins is now ready for use. The next steps would include installing plugins, configuring build jobs, and setting up CI/CD pipelines. This setup provides a foundation for automating software delivery processes in a DevOps environment.
Top comments (0)