How to Self-Host Jenkins on a VPS
Install Jenkins LTS on Ubuntu 24.04 from the project's apt repository with Java 21, put Caddy HTTPS in front, then back up JENKINS_HOME and its key.
Jenkins is an automation server for continuous integration and delivery. Pipelines live in a Jenkinsfile next to your code, and a large plugin catalogue connects it to Git hosts, build tools and deployment targets. This guide installs the Long Term Support (LTS) release by hand on Ubuntu 24.04 from the Jenkins apt repository, runs it as a systemd service, and puts Caddy in front for HTTPS.
Prefer one click? Deploy Jenkins from the VeloxaHost marketplace and skip the manual steps; this guide is for when you want to run every command yourself.
What you need
- A VeloxaHost server with the Ubuntu 24.04 LTS image. You get root, over SSH or in the browser terminal on the server's page.
- For HTTPS on a domain: a subdomain such as
jenkins.example.comand a dedicated IPv4 address. Webhooks from GitHub, GitLab or Gitea need a public HTTPS URL, and Caddy gets its certificate over ports 80 and 443, which the shared IPv4 address does not offer; it only gives you a block of forwarded ports. A dedicated IPv4 is a paid add-on (the console shows the current price): choose it as "Network access" on the create page, or take one from the IP addresses page and attach it. If none is free in the region, the request is refused.
The Jenkins docs give a floor of 256 MB of RAM and 1 GB of disk, and recommend 4 GB of RAM and 50 GB of disk for a small team. Build history and artifacts are what fill the disk. A Veloxa 2 (2 vCPU, 4 GB RAM, 80 GB disk) at $15 a month, billed at $0.03 an hour and capped at the monthly price, matches that recommendation.
Install Jenkins
Install Java first. Current LTS releases need Java 21 or later, and the docs warn that the service may fail to start if Java arrives after Jenkins.
sudo apt update sudo apt install fontconfig openjdk-21-jre java -versionAdd the LTS repository with its 2026 signing key, then install Jenkins. These are the commands from the Jenkins Linux page, unchanged.
sudo wget -O /etc/apt/keyrings/jenkins-keyring.asc \ https://pkg.jenkins.io/debian-stable/jenkins.io-2026.key echo "deb [signed-by=/etc/apt/keyrings/jenkins-keyring.asc]" \ https://pkg.jenkins.io/debian-stable binary/ | sudo tee \ /etc/apt/sources.list.d/jenkins.list > /dev/null sudo apt update sudo apt install jenkinsThe package creates a
jenkinsuser, starts the service on boot, sends its log to the journal and listens on port 8080. Its home,JENKINS_HOME, is/var/lib/jenkins.Make Jenkins listen on localhost only, so the outside world reaches it through Caddy. Open a drop-in for the service:
sudo systemctl edit jenkinsAdd these lines.
JENKINS_OPTSand the--httpListenAddress=127.0.0.1flag both come from the Jenkins docs; putting them together is our step.[Service] Environment="JENKINS_OPTS=--httpListenAddress=127.0.0.1"sudo systemctl restart jenkinsMake the server answer on its dedicated IPv4. Add the address to the interface (check the name with
ip addr) and to the network configuration so it survives a reboot. Then point an A record forjenkins.example.comat it. IPv6 is not available in US East yet, so skip the AAAA record there.ip addr add 198.51.100.5/32 dev eth0Install Caddy from its apt repository, as in Caddy's install docs.
sudo apt install --yes debian-keyring debian-archive-keyring apt-transport-https curl curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list sudo chmod o+r /usr/share/keyrings/caddy-stable-archive-keyring.gpg sudo chmod o+r /etc/apt/sources.list.d/caddy-stable.list sudo apt update sudo apt install caddyReplace
/etc/caddy/Caddyfilewith the Jenkins docs' Caddy example and reload. Their example runs both in Docker and proxies tojenkins:8080; on one server the target is127.0.0.1:8080.jenkins.example.com { encode zstd gzip reverse_proxy 127.0.0.1:8080 }sudo systemctl reload caddy
Without a dedicated IPv4. Skip steps 4 to 6 and tunnel in through the first port of your block, which forwards to SSH, then open http://localhost:8080. Webhooks from outside cannot reach Jenkins this way, so jobs have to poll or be started by hand.
ssh -p 20000 -L 8080:127.0.0.1:8080 root@203.0.113.10
First login
Open https://jenkins.example.com and wait for Unlock Jenkins. Paste the one-time password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Choose Install suggested plugins unless you know what you need; you can add and remove plugins later. Then create the first administrator. If you skip that step, the unlock password stays the password of a user called admin, so do not skip it.
Next, go to Manage Jenkins, System, Jenkins Location and set the Jenkins URL to https://jenkins.example.com/. Links in emails and build status reports are built from it.
For email notifications, enter your provider's SMTP server under Manage Jenkins, System. Outbound TCP port 25 is blocked by default, so use port 587 or 465.
Secure it
In the console, go to Firewalls, New Firewall, Add Rule. Allow TCP 80 and 443 from 0.0.0.0/0 and TCP 22 only from YOUR.IP/32, then attach the firewall on the server's page. Until one is attached, all traffic is allowed. Port 8080 stays closed to the outside because Jenkins only listens on localhost.
From the Jenkins security docs:
- Do not build on the controller. Builds on the built-in node can read everything the Jenkins process can, credentials included. Under Manage Jenkins, Nodes, configure Built-In Node with 0 executors and run builds on agents instead, such as a second VeloxaHost server.
- Leave the inbound TCP agent port disabled, which is the default since Jenkins 2.0. Agents can connect over WebSocket through the HTTPS URL instead.
- Keep plugins current. Jenkins shows security warnings on the Manage Jenkins page; act on them.
- If you put secrets in the drop-in file, the docs suggest
chmod 600on it, sincesystemctl editcreates it readable by everyone.
Back it up
Everything lives in /var/lib/jenkins: config.xml and other *.xml files, the jobs folder with build records and archived artifacts, plugins, and the encrypted credentials in secrets. Workspaces can be skipped; a clean checkout recreates them.
The Jenkins docs single out one file. secrets/master.key decrypts every stored credential, so keep it out of routine backups and store a copy separately somewhere safe. This archive command is ours; stop Jenkins first for a consistent copy:
sudo systemctl stop jenkins
sudo tar czf /root/jenkins-home-$(date +%F).tar.gz --exclude=./secrets/master.key --exclude=./workspace -C /var/lib/jenkins .
sudo systemctl start jenkins
The docs also name the thinBackup plugin as the backup plugin that is still maintained, and say to test a backup by restoring it somewhere else.
Filesystem snapshots, which the Jenkins docs call the most consistent kind of backup, are built in. On VeloxaHost, snapshots are instant and free (5 on Starter, 30 on Pay as you go): server page, Snapshots, name, Create. Restoring overwrites the current state. Automatic snapshots run every hour, 6 hours, 12 hours, daily or weekly, kept for 1, 3, 7, 14 or 30 days. The Backups page creates, downloads and restores server backups (as a new server), on a schedule of every 6 hours, 12 hours, daily or weekly, keeping 1 to 10. A snapshot or server backup includes master.key, so treat downloaded copies as secrets.
Update it
Take a snapshot first. Jenkins core comes from the apt repository, so the install page's last two commands also upgrade it to the newest LTS:
sudo apt update
sudo apt install jenkins
The newest LTS was 2.580.1 when checked. Read the LTS upgrade notes before a jump of several releases. Plugins update separately under Manage Jenkins, Plugins, Updates; restart Jenkins when it asks. If an upgrade breaks a plugin, restore the snapshot.
Troubleshooting
"jenkins: failed to find a valid Java installation". Java was missing or too old when the service started. Install openjdk-21-jre and run sudo systemctl restart jenkins.
Jenkins does not start because the port is in use. Run sudo systemctl edit jenkins and set another port with Environment="JENKINS_PORT=8081", as the docs show, then change the Caddyfile to match.
"Your reverse proxy setup is broken". The Jenkins URL does not match the address in your browser. Set it to the exact HTTPS URL, trailing slash included.
Anything else. Read the service log with journalctl -u jenkins.
FAQ
What license is Jenkins under?
Jenkins core is released under the MIT license. Plugins are separate projects with their own licenses, so check them if licensing matters to you.
Which Java version does Jenkins need?
Java 21 or later for current LTS releases. The Jenkins Linux page installs OpenJDK 21 from Ubuntu's archive, before Jenkins itself, so the service finds it on first start.
Should builds run on the Jenkins server itself?
Not for long. Jenkins advises against building on the built-in node, because a build there has the same access to the controller's files as Jenkins. Set its executors to 0 and connect one or more agents, for example a separate VeloxaHost server sized for your builds.
Do I need a dedicated IPv4 address?
For webhooks and HTTPS on your own domain, yes, because Caddy needs ports 80 and 443 and the shared IPv4 address only offers a block of forwarded ports. For a private instance you open over an SSH tunnel, no.
Which VeloxaHost size fits Jenkins?
The Jenkins docs recommend 4 GB of RAM and 50 GB of disk for a small team. A Veloxa 2 (2 vCPU, 4 GB RAM, 80 GB disk) at $15 a month, billed at $0.03 an hour and capped at the monthly price, fits. If builds still run on the controller, a Veloxa 4 (4 vCPU, 8 GB RAM, 160 GB disk) at $30 a month, billed at $0.05 an hour and capped at the monthly price, gives them room.
Commands and settings checked on 2026-10-19 against the official documentation: www.jenkins.io, updates.jenkins.io, github.com, caddyserver.com. Software changes; if a step no longer matches, the vendor's docs win.
Ready to deploy?
Start a free trial, or compare plans to match your team's scale.