How to change the jenkins home directory location?
If you need to change the Jenkins home directory in Ubuntu, follow the instructions below:
Stop Jenkins /etc/init.d/jenkins stopCreate folder for new Jenkins home directorymkdir homeChange access rights for this folder and all folders and files insidesudo chown -R jenkins:jenkins homeFind 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/jenkinssudo nano /etc/default/jenkinsfind JENKINS_HOME and change path to new Jenkins home folderStart 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 commandsudo 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/homeIn my case the root_folder is media
That's all. Enjoy!
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 directorybefore 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