Bird
Raised Fist0
Jenkinsdevops~10 mins

Installing on Linux in Jenkins - Visual Walkthrough

Choose your learning style10 modes available
Process Flow - Installing on Linux
Update package index
↓
Install Java (Jenkins dependency)
↓
Add Jenkins repository key
↓
Add Jenkins repository
↓
Update package index again
↓
Install Jenkins package
↓
Start and enable Jenkins service
↓
Check Jenkins status
↓
END
This flow shows the step-by-step process to install Jenkins on Linux, starting from updating packages, installing dependencies, adding Jenkins repository, installing Jenkins, and finally starting the service.
Execution Sample
Jenkins
sudo apt update
sudo apt install openjdk-11-jdk -y
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt update
sudo apt install jenkins -y
sudo systemctl start jenkins
sudo systemctl enable jenkins
sudo systemctl status jenkins
This code installs Jenkins on a Debian-based Linux system by updating packages, installing Java, adding Jenkins repo, installing Jenkins, and starting the Jenkins service.
Process Table
StepCommandActionResultSystem State Change
1sudo apt updateUpdate package indexPackage lists updatedPackage index refreshed
2sudo apt install openjdk-11-jdk -yInstall JavaJava installedJava runtime available
3wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -Add Jenkins repo keyKey added successfullySystem trusts Jenkins repo
4sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'Add Jenkins repoRepo added to sources.list.dJenkins repo available for apt
5sudo apt updateUpdate package index againPackage lists updated with Jenkins repoPackage index refreshed with Jenkins packages
6sudo apt install jenkins -yInstall Jenkins packageJenkins installedJenkins software installed
7sudo systemctl start jenkinsStart Jenkins serviceJenkins service startedJenkins running
8sudo systemctl enable jenkinsEnable Jenkins service at bootJenkins enabled on startupJenkins auto-start configured
9sudo systemctl status jenkinsCheck Jenkins service statusActive (running)Confirmed Jenkins is running
10-End of installation-Jenkins installed and running
💡 Installation completes after Jenkins service is running and enabled on system boot.
Status Tracker
VariableStartAfter Step 2After Step 6After Step 7Final
package_indexoutdatedupdatedupdatedupdatedupdated
java_installednoyesyesyesyes
jenkins_repo_addednonoyesyesyes
jenkins_installednonoyesyesyes
jenkins_service_statusstoppedstoppedstoppedrunningrunning
jenkins_enabled_on_bootnonononoyes
Key Moments - 3 Insights
Why do we run 'sudo apt update' twice during installation?
The first 'apt update' refreshes the package list before installing Java. After adding the Jenkins repository, we run 'apt update' again to include Jenkins packages in the package list, as shown in steps 1 and 5 in the execution_table.
What happens if Java is not installed before Jenkins?
Jenkins requires Java to run. If Java is missing, Jenkins installation or startup will fail. Step 2 ensures Java is installed before Jenkins installation in step 6.
What does 'sudo systemctl enable jenkins' do?
It configures Jenkins to start automatically when the system boots. This is shown in step 8 where Jenkins is enabled on startup.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, at which step is Jenkins service started?
AStep 6
BStep 7
CStep 8
DStep 9
💡 Hint
Check the 'Action' column for 'Start Jenkins service' in the execution_table.
According to variable_tracker, when does 'jenkins_installed' change from 'no' to 'yes'?
AAfter Step 2
BAfter Step 7
CAfter Step 6
DAfter Step 8
💡 Hint
Look at the 'jenkins_installed' row and see when it changes value.
If we skip adding the Jenkins repository (step 4), what will happen when running 'sudo apt install jenkins'?
AInstallation fails because Jenkins package is not found
BJenkins installs successfully from default repos
CJava will not be installed
DJenkins service will start automatically
💡 Hint
Refer to step 4 and 6 in the execution_table about repository addition and package installation.
Concept Snapshot
Installing Jenkins on Linux:
1. Update package index: sudo apt update
2. Install Java: sudo apt install openjdk-11-jdk -y
3. Add Jenkins repo key and repo
4. Update package index again
5. Install Jenkins: sudo apt install jenkins -y
6. Start and enable Jenkins service
Key: Java must be installed first; repo must be added before Jenkins install.
Full Transcript
To install Jenkins on Linux, first update the package index to get the latest package info. Then install Java, which Jenkins needs to run. Next, add the Jenkins repository key and repository to your system so apt can find Jenkins packages. Update the package index again to include Jenkins packages. Install Jenkins using apt. Finally, start the Jenkins service and enable it to start automatically on boot. Check the service status to confirm Jenkins is running. This process ensures Jenkins is properly installed and ready to use.

Practice

(1/5)
1. What is the first step before installing Jenkins on a Linux system?
easy
A. Create a Jenkins user account manually
B. Start the Jenkins service immediately
C. Add Jenkins repository key without installing Java
D. Install Java (OpenJDK) because Jenkins requires it to run

Solution

  1. Step 1: Understand Jenkins prerequisites

    Jenkins requires Java to run, so Java must be installed first.
  2. Step 2: Confirm prerequisite installation order

    Installing Java first ensures Jenkins can run properly after installation.
  3. Final Answer:

    Install Java (OpenJDK) because Jenkins requires it to run -> Option D
  4. Quick Check:

    Java installation is the first step [OK]
Hint: Always install Java before Jenkins on Linux [OK]
Common Mistakes:
  • Trying to start Jenkins before Java is installed
  • Skipping Java installation
  • Adding repository key before Java
2. Which command correctly adds the Jenkins repository key on a Debian-based Linux system?
easy
A. curl https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-get update
B. sudo rpm --import https://pkg.jenkins.io/debian-stable/jenkins.io.key
C. wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
D. sudo apt-get install jenkins-key

Solution

  1. Step 1: Identify the correct key import command for Debian

    Debian uses apt-key to add repository keys, and wget with pipe is common.
  2. Step 2: Verify command syntax

    The command uses wget to download the key and pipes it to apt-key add, which is correct.
  3. Final Answer:

    wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add - -> Option C
  4. Quick Check:

    apt-key add with wget is correct for Debian [OK]
Hint: Use wget and apt-key to add Jenkins key on Debian [OK]
Common Mistakes:
  • Using rpm commands on Debian
  • Trying to install a non-existent package 'jenkins-key'
  • Using curl without proper piping
3. After adding the Jenkins repository and updating package lists, what is the output of the command sudo systemctl status jenkins immediately after installation but before starting Jenkins?
medium
A. Active: active (running)
B. Active: inactive (dead)
C. Active: failed
D. Unit jenkins.service could not be found

Solution

  1. Step 1: Understand Jenkins service state after installation

    Installing Jenkins does not start the service automatically; it remains inactive.
  2. Step 2: Interpret systemctl status output

    Since Jenkins is not started yet, status shows inactive (dead), not running or failed.
  3. Final Answer:

    Active: inactive (dead) -> Option B
  4. Quick Check:

    Service inactive before start command [OK]
Hint: Service is inactive until explicitly started [OK]
Common Mistakes:
  • Assuming service auto-starts after install
  • Confusing 'failed' with 'inactive'
  • Expecting 'unit not found' after install
4. You installed Jenkins on Linux but the command sudo systemctl start jenkins fails with 'Failed to start jenkins.service: Unit not found.' What is the most likely cause?
medium
A. Jenkins package was not installed properly or repository not added
B. Java is not installed on the system
C. Firewall is blocking Jenkins port 8080
D. You need to reboot the system before starting Jenkins

Solution

  1. Step 1: Analyze the error message

    'Unit not found' means systemd cannot find the Jenkins service file, likely missing installation.
  2. Step 2: Identify common causes

    Missing or incorrect repository setup or failed package install causes service file absence.
  3. Final Answer:

    Jenkins package was not installed properly or repository not added -> Option A
  4. Quick Check:

    Missing service file means Jenkins not installed correctly [OK]
Hint: Check Jenkins package and repo if service unit missing [OK]
Common Mistakes:
  • Blaming firewall for service start failure
  • Assuming Java missing causes 'unit not found'
  • Thinking reboot fixes missing service unit
5. You want to install Jenkins on a Linux server and ensure it starts automatically on boot. Which sequence of commands correctly achieves this?
hard
A. sudo apt install openjdk-11-jdk; add Jenkins repo and key; sudo apt update; sudo apt install jenkins; sudo systemctl enable jenkins; sudo systemctl start jenkins
B. sudo apt install jenkins; sudo systemctl start jenkins; sudo apt install openjdk-11-jdk; sudo systemctl enable jenkins
C. sudo systemctl start jenkins; sudo apt install openjdk-11-jdk; sudo apt install jenkins; sudo systemctl enable jenkins
D. sudo apt update; sudo apt install jenkins; sudo systemctl enable jenkins; sudo systemctl start jenkins

Solution

  1. Step 1: Install Java before Jenkins

    Jenkins requires Java, so install OpenJDK first to avoid runtime errors.
  2. Step 2: Add Jenkins repository and key, update package list, then install Jenkins

    Adding repo and key ensures latest Jenkins version is installed properly.
  3. Step 3: Enable Jenkins service to start on boot and start it now

    Enabling service ensures Jenkins auto-starts on reboot; starting it activates Jenkins immediately.
  4. Final Answer:

    sudo apt install openjdk-11-jdk; add Jenkins repo and key; sudo apt update; sudo apt install jenkins; sudo systemctl enable jenkins; sudo systemctl start jenkins -> Option A
  5. Quick Check:

    Correct install order and enable/start commands [OK]
Hint: Install Java first, then Jenkins, enable and start service [OK]
Common Mistakes:
  • Installing Jenkins before Java
  • Skipping repository setup
  • Not enabling service for auto-start
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard