Changing Jenkins' home directory on Ubuntu

published on August 04, 2011.
Heads-up! You're reading an old post and the information in it is quite probably outdated.

I’ve started to play around with Jenkins yesterday and I kinda don’t like that it’s default home directory is /var/lib/jenkins so I changed it to /home/jenkins, so I’m throwing the steps needed out here for future reference.

First, stop jenkins:

robert@odin:~$ sudo /etc/init.d/jenkins stop

Create the new home directory and move existing stuff from the old home to the new one:

robert@odin:~$ sudo usermod -m -d /home/jenkins jenkins

Now, I didn’t manage to set the ENV JENKINS_HOME to the new home, it was always using the old one, so I edited the init.d script:

robert@odin:~$ sudo vi /etc/init.d/jenkins

and in the “DAEMON_ARGS=…” line change JENKINS_HOME env to –env=JENKINS_HOME=/home/jenkins. In the end the whole line reads something like:

DAEMON_ARGS="--name=$NAME --inherit --env=JENKINS_HOME=/home/jenkins --output=$JENKINS_LOG --pidfile=$PIDFILE"

Update on September 20th: Vranac blogged about how to change the JENKINS_HOME properly

Start jenkins

robert@odin:~$ sudo /etc/init.d/jenkins start

and go to http://server:port/configure and verify that jenkins works as before and is using the new home.

Happy hackin’!

Tags: hack, jenkins, ubuntu.
Categories: Development, Software.

Thanks for reading! If you require help on a project of any kind, let's talk!

Robert Basic

Robert Basic

Software engineer, consultant, open source contributor.

Let's work together!

If you require outsourcing or consulting help on your projects, I'm available!

Robert Basic © 2008 — 2018
Get the feed