1.1 Jenkins部署
1.1.1 安装jdk
http://www.oracle.com/technetwork/java/javase/downloads/jdk9-downloads-3848520.html
wget http://mirrors.hust.edu.cn/apache//ant/binaries/apache-ant-1.9.9-bin.zip
JAVA_HOME=/mnt/jdk
ANT_HOME=/usr/local/ant-1.9.9
export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH
export classpath=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
1.2 Linux安装配置maven环境
wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz
上传maven到 /usr/local 下
解压:
放入/etc/profile
MAVEN_HOME=/usr/local/apache-maven-3.5.2
export MAVEN_HOME
export PATH=${PATH}:${MAVEN_HOME}/bin
[root@root jenkins]# mvn -v
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T15:58:13+08:00)
Maven home: /usr/local/apache-maven-3.5.2
Java version: 1.8.0_60, vendor: Oracle Corporation
Java home: /mnt/jdk/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-514.el7.x86_64", arch: "amd64", family: "unix"
[root@root jenkins]# echo $?
0
[root@root jenkins]#
1.3 linux安装tomcat
下载
wget http://mirrors.shuosc.org/apache/tomcat/tomcat-8/v8.5.24/bin/apache-tomcat-8.5.24.tar.gz
tar xf apache-tomcat-8.5.24.tar.gz
修改端口
tomcat-->config-->server.xml
第22行:8005
第71行:8080
第93行:8009
1.4 增加tomcat用户【用于jenkins部署发布用】
找到tomcat-->config-->tomcat-users.xml
打开后在<tomcat-users></tomcat-users>之间增加如下用户信息:
<role rolename="admin-gui"></role>
<role rolename="admin-script"></role>
<role rolename="manager-gui"></role>
<role rolename="manager-script"></role>
<role rolename="manager-jmx"></role>
<role rolename="manager-status"></role>
<user username="admin" password="admin" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui"/>
1.5 Linux配置并启动 Jenkins
wget http://updates.jenkins-ci.org/download/war/2.99/jenkins.war
上传jenkins.war到tomcat-->webapps下
进入tomcat-->bin目录下,使用Linux命令启动tomcat
./startup.sh
根据tomcat所在服务器ip地址和tomcat路径来访问jenkins项目
第2章 jenkins安装 二
Jenkins官网,每周会更新次,每次更新官网上会留两个包,右边的是最新的,左边的是最稳定的。
#下载官方提供的rpm包
yum -y install java
wget http://pkg.jenkins-ci.org/redhat/jenkins-2.99-1.1.noarch.rpm
#安装
rpm -ivh jenkins-2.99-1.1.noarch.rpm
#开启
service jenkins start
#l浏览器输入 (阿里云服务器需要设置8080端口规则)
ip:8080