Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change home directory of Jenkins?

Tags:

Simple question: How to change the jenkins home directory location? By default it points to /var/lib/jenkins whereas I want it to point to /home/jenkins. I have changed my $JENKINS_HOME to /home/jenkins but it doesn't help me.

like image 888
user1728119 Avatar asked Nov 02 '12 09:11

user1728119


People also ask

How do I change Jenkins home directory in Windows?

To change the location of Jenkins Home on Windows, simply add or update the JENKINS_HOME system variable and restart the CI/CD tool. When it restarts, the new Jenkins Home location will be used.

Where is Jenkins home directory?

You can find the location of the current home directory of the Jenkins server by logging into the Jenkins page. Once logged in, go to 'Manage Jenkins' & select the options 'Configure System'. Here the first thing you will see will be the path to your Home Directory.

What is Jenkins home directory?

The Jenkins home directory contains all the details of your Jenkins server configuration, details that you configure in the Manage Jenkins screen. These configuration details are stored in the form of a set of XML files. Many of the core configurations are stored in the config.


1 Answers

For me on Jenkins 2.7.2 on RHEL 7.2 after already starting jenkins and configuring a build, I needed to:

1) Change the jenkins user's home directory

sudo su - service jenkins stop vi /etc/passwd #  change the /var/lib/jenkins to /home/jenkins or whatever  

2) Change the setting in the start script to also find it

vi /etc/sysconfig/jenkins #   change the JENKINS_HOME to /home/jenkins or what ever 

3) Copy all the data to the new location (eg: /home/jenkins)

cd /home cp -Rf /var/lib/jenkins . chown -R jenkins:jenkins * 

4) Start it back up

service jenkins start 

And that seems to have done it for me.

like image 150
hack_on Avatar answered Sep 22 '22 01:09

hack_on