Find Jenkins Home and change the location of the JENKINS_HOME directory


What is the Jenkins house?

When Jenkins is running, all of its logs, cloned repositories, plugin configurations, and build artifacts are stored in the Jenkins Home folder. Basically every ounce of configuration that exists for your Jenkins installation is contained in the Jenkins Home directory. The Jenkins Home folder is the heart and soul of your CI / CD instance.

Back up this folder and you have backed up the entire server. Delete this folder and the next time you run the Jenkins WAR file it will assume this is a brand new installation and configure itself from scratch. The importance and significance of the Jenkins Home folder cannot be understated.


The location of the Jenkins Home folder depends on your operating system, and if you are Linux based, it depends on the distribution.

There are standard Jenkins Home locations that the CI / CD tool is set to by default, although these locations will change if you configure a JENKINS_HOME environment variable.

Jenkins Home on Windows defaults to a named folder .jenkins in the home directory of the user who starts the Jenkins server. On my own Windows 10 Jenkins server, where the user is named Owner, the original Jenkins location is:


Note that this is the default Jenkins Home location when you run the Jenkins WAR file. If you use the Jenkins installer to configure the instance, Windows JENKINS_HOME will be:


The Jenkins Home folder on Ubuntu Linux is located at:


Jenkins Home location on Windows and Ubuntu Linux.

Change Jenkins Home on Windows

The default Jenkins Home locations are only used if a JENKINS_HOME environment variable is not preconfigured. To change the location of Jenkins Home on Windows, just add or update the JENKINS_HOME system variable and restart the CI / CD tool. Upon restart, the new Jenkins Home location will be used.

Jenkins Home Windows Change

Edit Jenkins Home on Windows by updating the JENKINS_HOME system variable.

Change JENKINS_HOME on Ubuntu

Changing the JENKINS_HOME location on Ubuntu is a bit more complicated, as Jenkins must have permissions to access the new folder, and the etc / default / jenkins file needs to be updated.

The following set of commands would change the Jenkins Home location on Ubuntu Linux from the default to a new folder named / home / my_jenkins_home

sudo -i
sudo service jenkins stop
mkdir /home/my_jenkins_home
sudo chown jenkins:jenkins /home/my_jenkins_home
sudo cp -prv /var/li/jenkins /home/my_jenkins_home
sudo usermod -d /home/my_jenkins_home jenkins
sudo nana /etc/default/jenkins

After the Jenkins usermod command completes, open the / etc / default / jenkins file and update the JENKINS_HOME variable in it.

# jenkins home location

The next time you start Jenkins, the popular CI / CD tool will read from the new JENKINS_HOME location.

Source link


Leave A Reply