Run a Jenkins War File |Video upload date:  · Duration: PT3M50S  · Language: EN

Quick guide to running a Jenkins WAR file locally for testing with simple commands access and port tips

If you want a no fuss way to spin up Jenkins for local testing and light CI work then the single WAR file is your best friend and your guilty pleasure. This guide walks through downloading the WAR running it with java and getting through the first time setup without losing your mind or your plugins.

Get the Jenkins WAR file

Grab the jenkins.war from the official Jenkins site or a trusted mirror and drop it into a folder you do not plan to overthink. That one file contains an embedded servlet container so you do not need Tomcat to start playing with continuous integration on your laptop.

Run the WAR with Java

Open a terminal and run the embedded server with the classic command

java -jar jenkins.war

Want a different HTTP port because 8080 is that one port your other project hogs Use this

java -jar jenkins.war --httpPort=9090

Then open a browser and go to localhost on the chosen port. The console will print startup logs and an initial admin unlock key. If your terminal scrolled away you can find the same value in the Jenkins home folder under secrets/initialAdminPassword inside your Jenkins home directory which is often ~/.jenkins by default.

Complete the web based setup

When the UI asks for the unlock key paste the one from the console or from the file. Then pick the install recommended plugins path unless you enjoy spending time resolving plugin dependency puzzles. Create the first admin user when prompted and be warned that plugin downloads can take a few minutes depending on your internet and mood.

Where to put JENKINS_HOME if you want control

Set an explicit JENKINS_HOME environment variable to keep data in a predictable place. For example export JENKINS_HOME=/opt/jenkins or set it in a service file when you move to a system level setup. Predictability will save you a future apology to yourself.

Optional production options

  • Run as a system service for uptime that is more than optimistic. A systemd unit is a common choice on modern Linux.
  • Deploy the WAR to Tomcat or another servlet container if your ops team insists on servlet containers.
  • Containerize Jenkins or use orchestration if you expect many simultaneous builds and occasional chaos.

Example systemd unit to run the WAR

[Unit]
Description=Jenkins
After=network.target

[Service]
User=jenkins
ExecStart=/usr/bin/java -jar /opt/jenkins/jenkins.war
Restart=on-failure

[Install]
WantedBy=multi-user.target

Troubleshooting notes that save time

  • Port already in use Try a different port or kill the offending process.
  • Wrong Java version Jenkins needs a modern Java runtime such as OpenJDK 11 or OpenJDK 17 for recent releases. Use that and avoid surprises.
  • Slow plugin installs Be patient or prefetch plugins if you control a cached mirror for your CI fleet.
  • Logs are your friend Check the console output and the files under your Jenkins home directory when something odd happens.

Final hostile but honest advice

The single command method is perfect for demos development and quick experiments. For anything that needs to stay alive overnight or serve a team use a proper deployment method like a service a servlet container or container orchestration. That way Jenkins does not go down when your laptop goes to sleep or when someone bumps into your terminal.

Enjoy your local CI playground and remember to back up your jobs if you start caring about them. This tutorial covered downloading the WAR running it with java accessing the UI on the correct port unlocking the initial setup and options for running Jenkins in a more robust way for real devops workflows.

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.