Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change JENKINS_HOME on Red Hat Linux?

Tags:

jenkins

redhat

I used this procedure to install Jenkins:

https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+RedHat+distributions

After it was up and running I discovered the /var/lib/jenkins partition on my server is very small. I want to move it, but I do not want to change the user that it runs under. I am new to Linux and I'm stumped. How do I move it for example to my Home/Public folder? The "Jenkins" user doesn't seem to have a Home folder. Its running as a daemon on startup, so I have no idea where to configure those settings. Can I create a Home folder for the Jenkins user? How?

I read this article:

https://wiki.jenkins-ci.org/display/JENKINS/Administering+Jenkins

but do not understand HOW to "set the new Jenkins home". I have used the export command, and restarted the service, but the old path still shows up in the Manage Jenkins screens.

I've read the 2-3 similar questions on stackoverflow also, but there's always a big missing piece for me. Where to find that file where I change the path permanently?

like image 700
Dilbertina Avatar asked Feb 17 '14 21:02

Dilbertina


People also ask

Where is Jenkins_home in Linux?

Change Jenkins Home on Linux Note: The default location for the Jenkins configuration file on Ubuntu and Debian is /etc/default/jenkins. If you are working with RedHat, CentOS, or Fedora, the Jenkins configuration file is located at /etc/sysconfig/jenkins.

How do I change the default port for Jenkins in Linux?

Open the file using a text editor such as Notepad or Notepad++. Scroll down until you find the line that contains --httpPort=8080 and change the number to the port you want to set. Note: If you are using HTTPS with Jenkins, use java -jar jenkins. war --httpsPort=[port number] to change the port in the command prompt.


2 Answers

Here's an easy way to solve your problem. First, move the Jenkins directory from /var/lib/jenkins to /home/jenkins. Then create a symlink at /var/lib/jenkins pointing to /home/jenkins. And of course, stop the Jenkins service before doing that.

sudo service jenkins stop sudo mv /var/lib/jenkins /home sudo ln -s /home/jenkins /var/lib/jenkins sudo service jenkins start 
like image 164
David Levesque Avatar answered Sep 19 '22 01:09

David Levesque


I managed to change the home location for Jenkins by modifying content of /etc/sysconfig/jenkins file as follows:

JENKINS_HOME="/home/jenkins" 
like image 39
Richard Chen Avatar answered Sep 20 '22 01:09

Richard Chen