1.Jenkins
一、tomcat安装
1、下载JDK和Tomcat
//通过wget下载 wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.4/bin/apache-tomcat-8.5.4.tar.gz wget http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz?AuthParam=1498630374_ed6e8b60e10c2fa6bd317a72378bf086
- 1
- 2
- 3
2、JDK安装与配置
a、JDK解压
mkdir /usr/local/java cd /usr/local/java tar -zxvf jdk-8u101-linux-x64.tar.gz
- 1
- 2
- 3
b、配置环境
export JAVA_HOME=/usr/local/java export JAVA_BIN=$JAVA_HOME/bin export PATH=$PATH:$JAVA_HOME/bin export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
- 1
- 2
- 3
- 4
- 5
c、使配置生效
source /etc/profile
- 1
d、测试java是否安装成功
java -version //java版本信息 java version "1.7.0_101" OpenJDK Runtime Environment (IcedTea 2.6.6) (7u101-2.6.6-0ubuntu0.14.04.1) OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
- 1
- 2
- 3
- 4
- 5
- 6
3、Tomcat的安装
a、Tomcat解压
mkdir /usr/local/tomcat cd /usr/local/tomcat tar -zxvf jdk-8u101-linux-x64.tar.gz
- 1
- 2
- 3
b、启动Tomcat
cd /usr/local/tomcat/bin ./startup.sh
- 1
- 2
c、关闭Tomcat
shutdown.sh
- 1
4、配置Web管理账号
修改文件conf/tomcat-users.xml,在元素中添加帐号密码,需要指定角色
vim /usr/local/tomcat/conf/tomcat-users.xml
<tomcat-users> <user name="admin" password="admin" roles="admin-gui,manager-gui" /> </tomcat-users>
- 1
- 2
- 3
5、配置端口
可以修改conf目录下的文件server.xml,修改Connector元素(Tomcat的默认端口是8080),需要重新启动Tomcat服务生效。
vim /usr/local/tomcat/conf/server.xml
<Connector port="9999" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
- 1
6、访问Tomcat
http://ip:端口号/
http://localhost:9999/
- 1
7、添加应用
- cd /usr/local/tomcat/webapps
- 把war加入到webapps中,tomcat会自动解压war包
8、防火墙
如果服务器开启的防火墙,就开启tomcat端口可以访问
# /sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT # service iptables save # service iptables restart 或直接修改文件/etc/sysconfig/iptables. # vi /etc/sysconfig/iptables -A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT # service iptables restart 在浏览器输入: http://192.168.16.133:8080 如在本机可以输入: http://localhost:8080