One. Tomcat installation configuration
1. What is Tomcat
Tomcat is a software used to parse a JSP program.
Tomcat is a core project of the Apache Software Foundation (Apache Software Foundation) Jakarta Project, developed by Apache, Sun, and other companies and individuals.
Tomcat is a lightweight application server that is widely used in small and medium-sized systems and concurrent access users, and is developed and debugging JSP threads The first choice of the order.
2. Installing the JDK
Download JDK website address: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
(1. Unzip the JDK
Tar zxvf jdk-8u31-linux-i586.tar.gz mv jdk1.8.0_31/usr/local/jdk1.8.0_31 #看清楚自己的jdk版本, do not blindly copy
(2. Modify Environment variables
vim/etc/profile.d/java.sh//Add the following configuration [/etc/profile: This file sets the environment information for each user of the system, when the user first logs on, the file is executed. And the configuration from the/ETC/PROFILE.D directory File to collect shell settings.
Java_home=/usr/local/jdk1.8.0_31 #看清楚自己的jdk版本, do not blindly copy java_bin=/usr/local/jdk1.8.0_31/binjre_home=/usr/local/ Jdk1.8.0_31/jrepath= $PATH:/usr/local/jdk1.8.0_31/bin:/usr/local/jdk1.8.0_31/jre/binclasspath=/usr/local/ Jdk1.8.0_31/jre/lib:/usr/local/jdk1.8.0_31/lib:/usr/local/jdk1.8.0_31/jre/lib/charsets.jar
(3. Initialize
. /etc/profile.d/java.sh
(4. Test for configuration success &NBS P , &NB Sp
java -version
3. Install Tomcat
(1. Installing Tomcat
Cd/usr/local/src/wget Http://apache.fayea.com/tomcat/tomcat-7/v7.0.62/bin/apache-tomcat-7.0.62.tar.gztar ZXVF apache-tomcat-7.0.57.tar.gz #解压mv apache-tomcat-7.0.57/usr/local/tomcat #移动并改名cp-pv/usr/local/to Mcat/bin/catalina.sh/etc/init.d/tomcat #复制启动文件
(2. Modify the Startup file
Vim/etc/init.d/tomcat
# chkconfig: 2345 63 37 # 2345 boot level, 63 boot order, 37 off order # description: tomcat server init script #描述 # source function library . /etc/init.d/functions #加载funcations库文件 #java_home=/usr/local/jdk1.8.0_31 #不要盲目复制, note the JDK version specifies the directory for the JDK catalina_home=/usr/local/tomcat #指定tomcat的路径
chmod 755 /etc/init.d/tomcat #让用户有权限启动tomcat chkconfig --add tomcat #把tomcat添加到系统服务 chkconfig tomcat on #tomcat开机启动 service tomcat start #启动tomcat ps aux | grep tomcat #查看有没有tomcat进程
(3. Configure Tomcat
To change the default boot port:
Cd/usr/local/tomcat
Vim Conf/server.xml
#把Connector port= "8080" instead of Connector port= "
To Configure a new virtual host:
<Host>
unpackwars= "false" autodeploy= "true" xmlvalidation= "false"
xmlnamespaceaware= "false" >
<context path= "" docbase= "./" debug= "0" reloadable= "true" crosscontext= "true"/>
</Host>
Restart : Service tomcat stop; service Tomcat start
4. Test JSP parsing
vim/data/tomcatweb/111.jsp//contents are as follows:
Now time is : <%=new java.util.Date ()%>
</center></body>
curl-xlocalhost:80 www.111.com/111.jsp
See if the results are similar:
Now time is:wed Jan 22:33:37 CST
</center></body>
This article is from the "Ming Linux blog" blog, be sure to keep this source http://zhaijunming5.blog.51cto.com/10668883/1694619
Centos 6.5 Configuration Tomcat