0
0
JenkinsHow-ToBeginner · 3 min read

How to Start Jenkins: Simple Steps to Run Jenkins Server

To start Jenkins, run the command sudo systemctl start jenkins on Linux systems where Jenkins is installed as a service. Alternatively, you can start Jenkins by running java -jar jenkins.war if you have the Jenkins WAR file. This launches the Jenkins server, accessible via http://localhost:8080.
📐

Syntax

There are two common ways to start Jenkins depending on your setup:

  • Using system service: sudo systemctl start jenkins starts Jenkins as a background service on Linux.
  • Using WAR file: java -jar jenkins.war runs Jenkins directly from the WAR file, useful for testing or manual start.

The system service method is typical for production setups, while the WAR file method is simple for local testing.

bash
sudo systemctl start jenkins

java -jar jenkins.war
💻

Example

This example shows how to start Jenkins using the WAR file method on any system with Java installed.

bash
wget https://get.jenkins.io/war-stable/2.414.3/jenkins.war
java -jar jenkins.war
Output
Running from: /path/to/jenkins.war 2024-06-01 12:00:00.000+0000 [id=1] INFO org.eclipse.jetty.server.Server#main: Started @12345ms Jenkins is fully up and running
⚠️

Common Pitfalls

Common mistakes when starting Jenkins include:

  • Not running the start command with sufficient permissions (use sudo on Linux).
  • Trying to start Jenkins without Java installed or with an incompatible Java version.
  • Port 8080 already in use, causing Jenkins to fail to start.
  • Not waiting long enough for Jenkins to fully start before accessing the web interface.

Always check Jenkins logs for errors if it does not start properly.

bash
# Wrong: java -jar jenkins.war
# Right: sudo java -jar jenkins.war
# Make sure Java is installed and port 8080 is free
📊

Quick Reference

Here is a quick summary of commands to start Jenkins:

CommandDescription
sudo systemctl start jenkinsStart Jenkins as a Linux service
sudo service jenkins startAlternative service start command on some Linux distros
java -jar jenkins.warStart Jenkins manually from WAR file
systemctl status jenkinsCheck Jenkins service status
netstat -tuln | grep 8080Check if port 8080 is in use

Key Takeaways

Use 'sudo systemctl start jenkins' to start Jenkins as a service on Linux.
Run 'java -jar jenkins.war' to start Jenkins manually if you have the WAR file.
Ensure Java is installed and port 8080 is free before starting Jenkins.
Check Jenkins logs and service status if Jenkins does not start properly.
Access Jenkins at http://localhost:8080 after starting the server.