jenkins配置JENKINS_HOME

当把jekins的war包放到Tomcat的webapp目录后,启动Tomcat服务后,访问jenkins的网址,进行首次密码验证时,显示密码生成在了C:\Windows\system32\config\systemprofile\.jenkins\secrets\initialAdminPassword这个目录。但实际上没有这个文件生成。

这时由于没有配置JENKINS_HOME这个环境变量,所以找不到而显示了这么个位置。

Getting Started

Unlock Jenkins

To ensure Jenkins is securely set up by the administrator, a password has been written to the log (not sure where to find it?) and this file on the server:

C:\Windows\system32\config\systemprofile\.jenkins\secrets\initialAdminPassword

Please copy the password from either location and paste it below.

Administrator password

所以要向下面方法一样,配置JENKINS_HOME这个环境变量,这样jenkins就知道使用那个目录了。下面安装目录,指的就是webapp下面解包出来的jenkins目录。

5.安装Jenkins

方法1:

jenkins.war下载地址:   http://mirrors.jenkins-ci.org/war/latest/jenkins.war

将jenkins.war复制到D:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps目录下

配置环境变量

新建JENKINS_HOME系统环境变量,变量值处输入JENKINS安装目录,如 "D:\jenkins"

或者 编辑D:\Program Files\Apache Software Foundation\Tomcat 9.0\conf\context.xml,添加JENKINS_HOME环境变量。

<Context ...>

<Environment name="JENKINS_HOME" value="D:/jenkins/" type="java.lang.String"/>

</Context>

访问Jenkins主页  http://localhost:8080/jenkins

配置完成环境变量后,重启Tomcat服务。访问jenkins主页,可以看到在下面配置目录下生成了正确的密码文件

Getting Started

Unlock Jenkins

To ensure Jenkins is securely set up by the administrator, a password has been written to the log (not sure where to find it?) and this file on the server:

C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\jenkins\secrets\initialAdminPassword

Please copy the password from either location and paste it below.

Administrator password

最后对Jenkins的安装方式进行总结下:

1. 下载wins版本exe程序安装, 不依赖与Tomcat服务器,可以控制面板卸载。据说服务在wins后台运行,调查问题不方便

2.  使用java -jar jenkins.war 形式(超级用户权限下哦)运行,不依赖Tomcat。使用的内置的jetty服务器

3. 使用tomcat的容器加载war包,把war包放在tomcar的webapps目录下,启动tomcat,会自动解压。依赖Tomcat

猜你喜欢

转载自blog.csdn.net/J283255144/article/details/85853844