没有安装jenkins时如何更改Jenkins主目录(〜/.jenkins) [英] How to change Jenkins home directory (~/.jenkins) when there is no jenkins installed

查看:269
本文介绍了没有安装jenkins时如何更改Jenkins主目录(〜/.jenkins)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从未在服务器上安装Jenkins.我所做的就是下载.war文件,tomcat托管了该文件.默认情况下,它在我的主目录(〜/.jenkins)下创建了一个目录,Jenkins使用该目录为其自己的配置和参数设置.

I never installed Jenkins on my server. All I have done was downloading .war file and tomcat is hosting it. By default it made a directory under my home directory (~/.jenkins) which Jenkins using for its own config and parameters.

反正有没有要更改Jenkins指向的目录?我需要移动这个目录. 我搜索了很多东西,但是所有人都为已经安装了Jenkins的情况提供了解决方案.

Is there anyway to change the directory that Jenkins is pointing to? I need to move this directory. I searched for that a lot but people all gave a solution for the case that Jenkins is installed already.

服务器正在运行"Red Hat Enterprise Linux Server 6.7版",并且Jenkins版本是1.642.4.

The server is running 'Red Hat Enterprise Linux Server release 6.7', and Jenkins version is 1.642.4.

推荐答案

对于Apache Tomcat,可以在$CATALINA_BASE/bin/setenv.sh文件中指定启动参数,包括用于指定Jenkins目录的JENKINS_HOME:

In case of Apache Tomcat you can specify startup parameters, including JENKINS_HOME for specifying Jenkins directory, in $CATALINA_BASE/bin/setenv.sh file:

$ cat setenv.sh

CATALINA_PID="${CATALINA_BASE}/tomcat.pid"
CATALINA_OPTS="-Duser.language=en -Duser.country=US -Djava.awt.headless=true -DJENKINS_HOME=${JENKINS_HOME} -Xms1024m -Xmx8192m -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true"

在上面的示例中,${JENKINS_HOME}设置了一个环境变量,但是您可以用绝对路径替换它.

In above example ${JENKINS_HOME} is set an environment variable, but you can replace it by absolute path.

有关更多详细信息,请参阅Apache Tomcat 文档.

Please refer to Apache Tomcat documentation for more details.

这篇关于没有安装jenkins时如何更改Jenkins主目录(〜/.jenkins)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆