How to change home directory of Jenkins?

后端 未结 4 440
南旧
南旧 2021-02-02 10:59

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

4条回答
  •  不要未来只要你来
    2021-02-02 11:03

    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.

提交回复
热议问题