Venkat S
Venkat S

Reputation: 31

How to change the jenkins home directory location?

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 /mnt/home/jenkins. I have changed my $JENKINS_HOME to /mnt/home/jenkins but it doesn't help me.

I am getting jenkins Ui problem. see below error. If i leave same /var/lib/jenkins/ it's working fine. HTTP ERROR: 503

Problem accessing /. Reason:

Service Unavailable

Powered by Jetty://

Upvotes: 2

Views: 14691

Answers (2)

prashanth kumar
prashanth kumar

Reputation: 91

If you need to change the Jenkins home directory in Ubuntu, follow the instructions below:

Stop Jenkins 
/etc/init.d/jenkins stop

Create folder for new Jenkins home directory
mkdir home

Change access rights for this folder and all folders and files inside
sudo chown -R jenkins:jenkins home

Find current Jenkins folder and copy all directories and files into new one. If you don't know current Jenkins directory you can find it in /etc/default/jenkins file.
sudo -u jenkins cp -r /var/lib/jenkins/* home/

Change JENNIKS_HOME inside /etc/default/jenkins
sudo nano /etc/default/jenkins

find JENKINS_HOME and change path to new Jenkins home folder

Start Jenkins 
/etc/init.d/jenkins start 

In case if you have the error message 
Unable to create the home directory ‘/path/to/jenkins/home’. This is most likely a permission problem.
run the command
sudo chown -R jenkins:jenkins root_folder/

To get the root_folder you need go to Jenkins home folder and run pwd. This will work in case if you want use other one hdd (not system) for Jenkins home .
$pwd
/media/path/to/jenkins/home

In my case the root_folder is media

That's all. Enjoy!

Source: http://www.sofment.com/?q=node/25

Upvotes: 4

dildeepak
dildeepak

Reputation: 1389

By default, Jenkins home is set to ~/.jenkins, but you can change this in one of the following ways:

  • Set "JENKINS_HOME" environment variable to the new home directory before launching the servlet container.
  • Set "JENKINS_HOME" system property to the servlet container.
  • Set JNDI environment entry "JENKINS_HOME" to the new directory.

Refer the below URL from jenkins https://wiki.jenkins-ci.org/display/JENKINS/Administering+Jenkins

Upvotes: 2

Related Questions