由于大部分服务器无法连接外网,所以这里只提供tar安装方式
一、环境搭建
1.JDK安装与配置
(1)JDK安装(tar.gz包:解压缩)
# mkdir /disk/tool
# cd /disk/tool
# tar -zxvf /software/jdk-7u79-linux-x64.tar.gz
(2)配置环境变量
# vi /etc/profile
export JAVA_HOME=/disk/tool/jdk1.7.0_79
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
使配置生效
# source /etc/profile
测试JDK
# java -version
2.Tomcat的安装与配置
(1)解压缩
# cd /disk/tool
# tar -zxvf /software/apache-tomcat-7.0.70.tar.gz
(2)检测Tomcat是否安装成功
# cd /disk/tool/apache-tomcat-7.0.70/bin
# ./startup.sh
打开防火墙,使外部能访问
# /sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
# service iptables save
# service iptables restart
在浏览器输入: http://192.168.16.1:8080
停止Tomcat
# ./shutdown.sh
3.Nginx的安装与配置
(1)工具包安装
依次安装openssl-fips-2.0.13.tar.gz, zlib-1.2.8.tar.gz, pcre2-10.00.tar.gz, nginx-1.5.9.tar.gz
1).安装openssl-fips-2.0.13.tar.gz
# mkdir /disk/tool/nginx
# cd /disk/tool/nginx
# tar -zxvf /software/openssl-fips-2.0.13.tar.gz
# cd openssl-fips-2.0.13
# ./config
# make
# make install
2).安装zlib-1.2.8.tar.gz
# cd /disk/tool/nginx
# tar -zxvf /software/zlib-1.2.8.tar.gz
# cd zlib-1.2.8
# ./configure
# make
# make install
3).安装pcre2-10.00.tar.gz
# cd /disk/tool/nginx
# tar -zxvf /software/pcre2-10.00.tar.gz
# cd pcre2-10.00
# ./configure
# make
# make install
4).安装 nginx-1.5.9.tar.gz
# cd /disk/tool/nginx
# tar -zxvf /software/nginx-1.5.9.tar.gz
# cd nginx-1.5.9
# ./configure --with-pcre=../pcre2-10.00 --with-zlib=../zlib-1.2.8 --with-openssl=../openssl-fips-2.0.13
# make
# make install
至此Nginx的安装完成!
(2)检测Nginx是否安装成功
# cd /disk/tool/nginx/nginx-1.5.9/sbin
# ./nginx -t
启动nginx
# ./nginx
查看端口
# netstat -ntlp