linux学习笔记-第二十七课-tamcat与resin
一、tomcat
1、 安装JDK
[root@web src]# tar -zxvf jdk-7u79-linux-i586.tar.gz # 编辑初始化信息脚本 [root@web src]# mv jdk1.7.0_79 /usr/local/jdk1.7.0_79 [root@web src]# vim /etc/profile.d/java.sh JAVA_HOME=/usr/local/jdk1.7.0_79 JAVA_BIN=/usr/local/jdk1.7.0_79/bin JRE_HOME=/usr/local/jdk1.7.0_79/jre PATH=$PATH:/usr/local/jdk1.7.0_79/bin:/usr/local/jdk1.7.0_79/jre/bin CLASSPATH=/usr/local/jdk1.7.0_79/jre/lib:/usr/local/jdk1.7.0_79/lib:/usr/local/jdk1.7.0_79 /jre/lib/charsets.jar # 查看安装的脚本 [root@web ~]# chmod 600 /etc/profile.d/java.sh [root@web ~]# . /etc/profile.d/java.sh # 代表jdk成功安装 [root@web src]# java -version java version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java HotSpot(TM) Server VM (build 24.79-b02, mixed mode)
2、安装tomcat
[root@web src]# tar -xvf apache-tomcat-7.0.62.tar.gz [root@web src]# mv apache-tomcat-7.0.62 /usr/local/tomcat [root@web src]# cd apache-tomcat-7.0.62 [root@web tomcat]# cp -pv bin/catalina.sh /etc/init.d/tomcat "bin/catalina.sh" -> "/etc/init.d/tomcat" # 编辑脚本 [root@web 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.7.0_79 CATALINA_HOME=/usr/local/tomcat .......................... [root@web tomcat]# chmod 755 /etc/init.d/tomcat [root@web tomcat]# chkconfig --add tomcat [root@web tomcat]# chkconfig tomcat on [root@web tomcat]# 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.7.0_79 Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar Tomcat started. [root@web tomcat]# ps aux |grep tomcat root 1430 5.0 4.1 672124 79880 pts/0 Sl 13:56 0:03 /usr/local/jdk1.7.0_79/ 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 1453 0.0 0.0 5980 720 pts/0 D+ 13:57 0:00 grep tomcat [root@web tomcat]#
浏览器输入IP:8080,出现如下页面
# 编辑配置测试 [root@web tomcat]# vim /usr/local/tomcat/conf/server.xml <Host name="www.a.com" appBase="/data/tomcatweb" unpackWARs="false" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Context path="" docBase="./" debug="0" reloadable="true" crossContext="true"/> </Host> [root@web data]# vim /data/tomcatweb/111.jsp <html><body><center> Now time is: <%=new java.util.Date()%> </center></body></html> # 测试成功,说明tomcat搭建OK [root@web data]# curl -xlocalhost:80 www.a.com/111.jsp <html><body><center> Now time is: Sun May 31 15:57:15 CST 2015 </center></body></html>
二、resin
安装resin同样需要安装JDK,和tomcat一样,安装方法和tomcat中讲到的一样,下面我们讲一下怎么安装resin
[root@resin src]# wget http://caucho.com/download/resin-pro-4.0.44.tar.gz [root@resin src]# tar -xvf resin-pro-4.0.44.tar.gz [root@resin resin-pro-4.0.44]# ./configure --prefix=/usr/local/resin --with-java-home=/usr/local/jdk1.7.0_80 [root@resin resin-pro-4.0.44]# make [root@resin resin-pro-4.0.44]# make install [root@resin resin-pro-4.0.44]# /etc/init.d/resin start Starting resin: . [root@resin resin-pro-4.0.44]# vim /usr/local/resin/conf/resin.xml ........................................... # resin默认监听目录/usr/local/resin/webapps/ROOT <host id="" root-directory="."> <!-- - webapps can be overridden/extended in the resin.xml --> <web-app id="/" root-directory="webapps/ROOT"/> </host> ............................................ # 我们在这个目录编译一个测试页面 [root@resin ROOT]# vim test.jsp <html><body><center> Now time is: <%=new java.util.Date()%> </center></body></html>
浏览器测试:
Linux测试
[root@client ~]# curl 192.168.1.114:8080/test.jsp <html><body><center> Now time is: Sat Jun 06 23:41:02 CST 2015 </center></body></html>
本文出自 “Topspeed_King” 博客,请务必保留此出处http://mylinuxlife.blog.51cto.com/4706737/1659304
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。