标签:tomcat tomcat安装 tomcat配置 jdk安装
一、tomcat安装配置
1、 什么是tomcat
Tomcat就是用来解析jsp程序的一个软件;web容器;
Tomcat是Apache 软件基金会(Apache Software Foundation)的Jakarta项目中的一个核心项目,由Apache、Sun和其他一些公司及个人共同开发而成。
Tomcat是一个轻量级应用服务器,在中小型系统和并发访问用户不是很多的场合下被普遍使用,是开发和调试JSP程序的首选。
2. 要想运行tomcat,必须先安装JDK
去官网下载jdk后解压:
tar -zxvf jdk-8u31-linux-i586.tar.gz
mv jdk1.8.0_31 /usr/local/jdk1.8.0_31
vim /etc/profile.d/java.sh //加入本地环境变量如下配置:
JAVA_HOME=/usr/local/jdk1.8.0_45
JAVA_BIN=/usr/local/jdk1.8.0_45/bin
JRE_HOME=/usr/local/jdk1.8.0_45/jre
PATH=$PATH:/usr/local/jdk1.8.0_45/bin:/usr/local/jdk1.8.0_45/jre/bin
CLASSPATH=/usr/local/jdk1.8.0_45/jre/lib:/usr/local/jdk1.8.0_45/lib:/usr/local/jdk1.8.0_45/jre/lib/charsets.jar
让java.sh生效执行#. /etc/profile.d/java.sh
如果以上配置成功,则下面的命令可以看到java的版本:
[root@localhost src]# java -version
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) Client VM (build 25.31-b07, mixed mode)
3、安装tomcat,先去下载,可以自行去官网下载最新版本
cd /usr/local/src/
wget http://apache.fayea.com/tomcat/tomcat-7/v7.0.62/bin/apache-tomcat-7.0.62.tar.gz
tar -zxvf apache-tomcat-7.0.62.tar.gz
mv apache-tomcat-7.0.62 /usr/local/tomcat
cp -pv /usr/local/tomcat/bin/catalina.sh /etc/init.d/tomcat
"/usr/local/tomcat/bin/catalina.sh" -> "/etc/init.d/tomcat"
vim /etc/init.d/tomcat //从第二行加入
# chkconfig: 2345 63 37
# description: tomcat server init script
# Source Function Library
. /etc/init.d/functions
JAVA_HOME=/usr/local/jdk1.8.0_45
CATALINA_HOME=/usr/local/tomcat
4、加入开机自启动
chmod 755 /etc/init.d/tomcat
chkconfig --add tomcat
chkconfig tomcat on
service tomcat start
ps aux |grep tomcat
[root@localhost src]# service tomcat start
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/jdk1.8.0_31
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@localhost src]# ps aux |grep tomcat
root 9324 48.2 3.6 332716 37312 pts/0 Sl 15:49 0:08 /usr/local/jdk1.8.0_31/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat/endorsed -classpath /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start
root 9337 0.0 0.0 5980 740 pts/0 S+ 15:49 0:00 grep tomcat
浏览器输入 http://ip:8080 可以看到tomcat的欢迎页,证明配置成功
本文出自 “山猫” 博客,转载请与作者联系!
标签:tomcat tomcat安装 tomcat配置 jdk安装
原文地址:http://cqtangbo.blog.51cto.com/2978612/1752517