1. 实验环境:
systemctl stop firewalld iptables -A INPUT -p tcp -s 0/0 --dport 80 -j ACCEPT iptables -A OUTPUT -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT iptables -A INPUT -p tcp -s 0/0 --dport 8080 -j ACCEPT iptables -A OUTPUT -p tcp --sport 8080 -m state --state ESTABLISHED -j ACCEPT iptables-save
2. 安装 Java 环境
a. 安装包下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html (请根据实际情况选择对应的安装包)
b. 配置环境变量:
vim /etc/profile.d/jdk.sh ---------------------------------------------------> JAVA_HOME=/usr/local/jdk PATH=$JAVA_HOME/bin:$PATH export JAVA_HOME PATH <--------------------------------------------------- . /etc/profile.d/jdk.sh //重读此文件,让变量生效
3. 查看JAVA是否安装成功:
[[email protected] local]# java -version java version "1.8.0_60" Java(TM) SE Runtime Environment (build 1.8.0_60-b27) Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
3. 安装 Tomcat
wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-9/v9.0.0.M17/bin/apache-tomcat-9.0.0.M17.tar.gz tar xzvf apache-tomcat-9.0.0.M17.tar.gz -C /usr/local/ cd /usr/local/ ln -sv apache-tomcat-9.0.0.M17 tomcat
vim /etc/profile.d/tomcat.sh ---------------------------------------------------> CATALINA_BASE=/usr/local/tomcat PATH=$CATALINA_BASE/bin:$PATH JENKINS_HOME=$CATALINA_BASE/webapps/jenkins export PATH CATALINA_BASE JENKINS_HOME <--------------------------------------------------- . /etc/profile.d/tomcat.sh
c. 查看tomcat是否安装成功:
[[email protected] local]# catalina.sh version Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr/local/jdk Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar Server version: Apache Tomcat/9.0.0.M17 Server built: Jan 10 2017 20:59:20 UTC Server number: 9.0.0.0 OS Name: Linux OS Version: 3.10.0-327.28.3.el7.x86_64 Architecture: amd64 JVM Version: 1.8.0_60-b27 JVM Vendor: Oracle Corporation
4. 配置 Tomcat
vim /usr/local/tomcat/conf/server.xml ----------------------------------------------------------> <Connector port="80" protocol="HTTP/1.1" //默认端口为8080,改为80 connectionTimeout="20000" redirectPort="8443" />
b. tomcat有 manager-gui 的管理页面,想要使用必须配置管理用户,不使用可以跳过此步。配置tomcat-users.xml:
5. 安装 Jenkins 到 Tomcat
a. 安装包下载地址:http://mirrors.jenkins-ci.org/war/latest/jenkins.war
b. 安装完成,现在可以开启 Tomcat 来使用 jenkins 了:
c. 在 Client 上打开浏览器,访问 http://172.0.0.1/jenkins
参考文献:
http://www.linuxidc.com/Linux/2015-08/122234.htm
https://wiki.jenkins-ci.org/display/JENKINS/Tomcat
http://blog.sina.com.cn/s/blog_61df320b01019z4c.html
http://www.server110.com/linux/201308/740.html