软件包下载地址:
JAVA环境安装
yum -y update # 升级系统
cd /usr/local
wget http://javadl.sun.com/webapps/download/AutoDL?BundleId=111741 -O jre.tar.gz
tar zxvf jre.tar.gz
chown root:root jre1.8.0_66 # 默认的权限貌似不一样
echo "export JAVA_HOME=/usr/local/jre1.8.0_66" >> /etc/profile # 写入JAVA_HOME
echo "export CLASSPATH=.:%JAVA_HOME%/lib/dt.jar:%JAVA_HOME%/lib/tools.jar" >> /etc/profile # 写入JAVA_CLASSPATH
source /etc/profile # 立即生效
env |grep JAVA # 查看是否生效
#JAVA_HOME=/usr/local/jre1.8.0_66
#CLASSPATH=.:%JAVA_HOME%/lib/dt.jar:%JAVA_HOME%/lib/tools.jar
ln -s /usr/local/jre1.8.0_66/bin/java /sbin/java # 创建程序快捷方式,否则会提示找不到程序
java -version
#java version "1.8.0_66"
#Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
#Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
Tomcat 安装
# 生产环境最好还是Tomcat 7合适!
wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-9/v9.0.0.M1/bin/apache-tomcat-9.0.0.M1.tar.gz
tar zxvf apache-tomcat-9.0.0.M1.tar.gz
mv apache-tomcat-9.0.0.M1 tomcat
/usr/local/tomcat/bin/startup.sh #启动服务器
#Using CATALINA_BASE: /usr/local/tomcat
#Using CATALINA_HOME: /usr/local/tomcat
#Using CATALINA_TMPDIR: /usr/local/tomcat/temp
#Using JRE_HOME: /usr/local/jre1.8.0_66
#Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
#Tomcat started.
/usr/local/tomcat/bin/shutdown.sh # 关闭服务器
war包部署
打包项目为web.war文件,放置tomcat目录的webapps下!重启tomcat即可。访问地址为localhost/web (包的名字)
开机启动
vi /etc/rs.local
/usr/local/tomcat/bin/startup.sh
文章评论
看看!