Jenkins 是基于Java开发的一种持续集成工具,所以,Jenkins需要Java环境。
Tomcat是针对Java的一个开源中间件服务器(容器),基于Java Web的项目需要借助Tomcat 才能运行起来。
Tomcat官方网站:http://tomcat.apache.org/
双击运行Bin下startup.bat,启动Tomcat服务器。
-
jenkins 下载和安装
地址:http://jenkins.io/download/
下载完成后,点击安装,安装完会发现电脑里多了个jenkins文件夹,打开发现 jenkins.war,
将下载好的jenkins.war放进tomcat/webapps目录下。
相关配置
1 登入http://localhost:8080/jenkins,进入Jenkins初始化页面,第一次启动时间可能有点长,耐心等待。进入成功后会看到如下画面,按提示路径打开密码文件,输入密码:接下来根据提示进行安装。
Jenkins 正在帮我们安装各种主流插件。最后一步配置,创建 管理员账号。整个 Jenkins 安装配置完成
配置 Jenkins:Jenkins 安装完成会自动启动 TomCat , 并通过默认浏览器打开:http://localhost:8080/。
(你也可以手动进Tomcat的bin/目录下启动startup.bat ,通过浏览器访问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.
ministrator password
最后对Jenkins的安装方式进行总结下:
1. 下载windows版本exe程序安装, 不依赖与Tomcat服务器,可以控制面板卸载。但是是以服务在wins后台运行,执行脚本的时候不能看到页面,查找问题不方便。
2. 使用tomcat的容器加载war包,把war包放在tomcat的webapps目录下,启动tomcat,会自动解压。依赖Tomcat
3.使用java -jar jenkins.war 形式(超级用户权限下哦)运行,不依赖Tomcat。使用的内置的jetty服务器
也是支持UI界面的。