Bird
Raised Fist0
Jenkinsdevops~20 mins

Installing on Linux in Jenkins - Practice Exercises

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Jenkins Linux Installation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Jenkins service status after installation
After installing Jenkins on a Linux system using the official package, you run the command sudo systemctl status jenkins. What output indicates Jenkins is running correctly?
AActive: active (running) since Wed 2024-06-05 10:00:00 UTC; 5min ago
BActive: inactive (dead) since Wed 2024-06-05 10:00:00 UTC; 5min ago
CFailed to start Jenkins.service: Unit Jenkins.service not found.
DActive: activating (start) since Wed 2024-06-05 10:00:00 UTC; 5min ago
Attempts:
2 left
💡 Hint
Look for the word 'active' and 'running' in the status output.
❓ Configuration
intermediate
2:00remaining
Correct Jenkins repository setup on Debian-based Linux
Which of the following commands correctly adds the Jenkins repository key and source list for Debian-based Linux before installing Jenkins?
Asudo yum install jenkins && sudo systemctl enable jenkins
Bcurl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo rpm --import - && echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/yum.repos.d/jenkins.repo
Csudo apt-get install jenkins && sudo systemctl start jenkins
Dwget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add - && echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list
Attempts:
2 left
💡 Hint
Debian uses apt-key and sources.list.d for repositories.
🔀 Workflow
advanced
2:30remaining
Order of commands to install Jenkins on CentOS/RHEL
What is the correct order of commands to install Jenkins on CentOS or RHEL Linux?
A1,3,2,4
B3,1,2,4
C1,2,3,4
D3,2,1,4
Attempts:
2 left
💡 Hint
Java must be installed before Jenkins, then start and enable the service.
❓ Troubleshoot
advanced
2:00remaining
Diagnosing Jenkins startup failure on Linux
You installed Jenkins on Linux and tried to start it, but sudo systemctl start jenkins fails silently. Which log file should you check first to find the cause?
A/var/log/messages
B/var/log/syslog
C/var/log/jenkins/jenkins.log
D/var/log/jenkins/error.log
Attempts:
2 left
💡 Hint
Jenkins writes its own logs in a specific directory.
✅ Best Practice
expert
3:00remaining
Secure Jenkins installation on Linux
Which practice is best to secure Jenkins after installing it on a Linux server?
ARun Jenkins as root user to avoid permission issues
BConfigure Jenkins to run under a dedicated user with limited permissions
CDisable the firewall to allow all traffic to Jenkins
DOpen Jenkins port 8080 to the internet without authentication
Attempts:
2 left
💡 Hint
Running services with least privilege improves security.

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