一,安装jdk环境
先下载:官网(http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u26-download-400750.html)
在解压:
[root@China ~]# tar xvf jdk-8u141-linux-x64.gz
[root@China ~]# mv jdk1.8.0_141 /usr/local/
[root@China ~]# cd /usr/local/
[root@China local]# vim /etc/profile
配置环境变量:
export JAVA_HOME=/usr/local/jdk1.8.0_141
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
[root@China local]# source /etc/profile
测试:
[root@China local]# java -version
java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode)
出现这代表安装成功。
二.下载安装tomcat(http://tomcat.apache.org/)
[root@master ~]# unzip apache-tomcat-6.0.30.zip
[root@master ~]# mv apache-tomcat-6.0.30/ /usr/local/
[root@master ~]cd /usr/local/
[root@master local]# ln -s /usr/local/apache-tomcat-6.0.30/ /usr/local/tomcat
[root@master local]# cd tomcat/bin/
[root@master bin]#ls
[root@master bin]#vim catalina.sh
添加以下内容:
CATALINA_HOME=/usr/local/apache-tomcat-6.0.30/
[root@master local]#chmod +x *.sh
三.启动tomcat服务器
[root@master tomcat]# /usr/local/tomcat /bin/catalina.sh start
Using CATALINA_BASE: /usr/local/apache-tomcat-6.0.53/
Using CATALINA_HOME: /usr/local/apache-tomcat-6.0.53/
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.53//temp
Using JRE_HOME: /usr/local/jdk1.8.0_141
Using CLASSPATH: /usr/local/apache-tomcat-6.0.53//bin/bootstrap.jar
[root@master logs]# cd /usr/local/tomcat/logs/
[root@master logs]# tail -f catalina.out
七月 22, 2017 11:30:37 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory host-manager
七月 22, 2017 11:30:37 下午 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
七月 22, 2017 11:30:37 下午 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
七月 22, 2017 11:30:37 下午 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/25 config=null
七月 22, 2017 11:30:37 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 1220 ms
四.在浏览器中输入
http://localhost:8080/(如果不是本机,则输入对应的ip地址)
测试出现tomcat页面则测试成功,如下图
参考链接1:http://jingyan.baidu.com/article/ae97a646ea3feebbfd461d09.html
参考链接2:http://blog.csdn.net/zhuying_linux/article/details/6583096
对以上表示感谢:
本文转自 天道酬勤VIP 51CTO博客,原文链接:http://blog.51cto.com/tdcqvip/1950106