Linux上tomcat的安装

阅读更多
1.     去http://jakarta.apache.org/tomcat/ 下载一个Tomcat
[root@LinuxServer gz]#wget http://apache.bestwebcover.com/jakarta/tomcat-5/v5.5.4/bin/jakarta-tomcat-5.5.4.tar.gz &
[root@LinuxServer gz]#wget http://apache.bestwebcover.com/jakarta/tomcat-5/v5.5.4/bin/jakarta-tomcat-5.5.4.tar.gz.md5 &
2.     我为什么下载一个.md5文件?呵呵,这就是文件的数字指纹。在官方发布的时候,会提供一个指纹,即jakarta-tomcat-5.5.4.tar.gz.md5,用more命令看一个,其实是一个md5的字符串。如果这个文件被人修改过了(加入木马!),数字指纹就变了,在服务器上安装可就不安全了。我们可以用md5sum命令来进行验证指纹。
[root@LinuxServer gz]# more jakarta-tomcat-5.5.4.tar.gz.md5
b0ab66c5cc8737adeeffb5fbcb7f8395
[root@LinuxServer gz]# md5sum jakarta-tomcat-5.5.4.tar.gz
b0ab66c5cc8737adeeffb5fbcb7f8395  jakarta-tomcat-5.5.4.tar.gz
比较一下2个md5值,相等则表示该文件包是原装的。也有的文件数字指纹是这个格式的:
b0ab66c5cc8737adeeffb5fbcb7f8395  jakarta-tomcat-5.5.4.tar.gz
比如文件叫key.md5,可以用这种方法来验证:
[root@LinuxServer gz]# md5sum -c key.md5
jakarta-tomcat-5.5.4.tar.gz: OK
如果指纹中有1位不对的话,则会出现:
[root@LinuxServer gz]# md5sum -c key.md5
jakarta-tomcat-5.5.4.tar.gz: FAILED
md5sum: WARNING: 1 of 1 computed checksum did NOT match
3.     解压缩
[root@LinuxServer root]# cd /usr/local/
[root@LinuxServer local]# gunzip < /root/gz/jakarta-tomcat-5.5.4.tar.gz | tar xf -
我下的是二进制包,所以不用编译了,下面设置一个两个环境变量CATALINA_HOME和CATALINA_BASE,编辑~/.bashrc文件。
[root@LinuxServer local]# vi ~/.bashrc
set CATALINA_BASE=/usr/local/jakarta-tomcat-5.5.4
export CATALINA_BASE
set CATALINA_HOME=/usr/local/jakarta-tomcat-5.5.4
export CATALINA_HOME
退出shell,重新登陆一下,验证变量是否生效。
[root@LinuxServer local]# echo $CATALINA_HOME
/usr/local/jakarta-tomcat-5.5.4
[root@LinuxServer local]# echo $CATALINA_BASE
/usr/local/jakarta-tomcat-5.5.4
OK,已生效。
4.     运行tomcat console;
[root@LinuxServer local]# cd jakarta-tomcat-5.5.4/bin/
[root@LinuxServer bin]# ./catalina.sh run
Using CATALINA_BASE:   /usr/local/jakarta-tomcat-5.5.4
Using CATALINA_HOME:   /usr/local/jakarta-tomcat-5.5.4
Using CATALINA_TMPDIR: /usr/local/jakarta-tomcat-5.5.4/temp
Using JAVA_HOME:       /usr/java/j2sdk1.4.2_06
This release of Apache Tomcat was packaged to run on J2SE 5.0
or later. It can be run on earlier JVMs by downloading and
installing a compatibility package from the Apache Tomcat
binary download page.
[root@LinuxServer bin]#
什么?跑不起来?哦,原来少了一个compatibility的包,再去down一下。
5.     下载并安装jakarta-tomcat-5.5.4-compat.tar.gz包。
[root@LinuxServer bin]# cd ~/gz
[root@LinuxServer gz]# wget http://apache.bestwebcover.com/jakarta/tomcat-5/v5.5.4/bin/jakarta-tomcat-5.5.4-compat.tar.gz &
[root@LinuxServer gz]# cd /usr/local/
[root@LinuxServer local]# gunzip < /root/gz/jakarta-tomcat-5.5.4-compat.tar.gz | tar xf -
再来运行看看
[root@LinuxServer local]# ./jakarta-tomcat-5.5.4/bin/catalina.sh run
Using CATALINA_BASE:   /usr/local/jakarta-tomcat-5.5.4
Using CATALINA_HOME:   /usr/local/jakarta-tomcat-5.5.4
Using CATALINA_TMPDIR: /usr/local/jakarta-tomcat-5.5.4/temp
Using JAVA_HOME:       /usr/java/j2sdk1.4.2_06
Created MBeanServer with ID: 12a54f9:ffef84048d:-8000:LinuxServer:1
2004-10-31 23:04:31 org.apache.coyote.http11.Http11Protocol init
……
2004-10-31 23:05:37 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: sessionDestroyed('75EB15D4C6F698AB0C95C5C8E4F259FA')
OK,成功。打开浏览器:http://192.168.0.88:8080/,看到了盼望已久CAT!安装成功。
当然,现在的tomcat只安装最基本的包,还有一些没有装,可以Down下来一起装个FULL版。
[root@LinuxServer local]# cd ~/gz/
[root@LinuxServer gz]# wget http://apache.bestwebcover.com/jakarta/tomcat-5/v5.5.4/bin/jakarta-tomcat-5.5.4-admin.tar.gz &
[root@LinuxServer gz]# wget http://apache.bestwebcover.com/jakarta/tomcat-5/v5.5.4/bin/jakarta-tomcat-5.5.4-deployer.tar.gz &
[root@LinuxServer gz]# wget http://apache.bestwebcover.com/jakarta/tomcat-5/v5.5.4/bin/jakarta-tomcat-5.5.4-embed.tar.gz &
[root@LinuxServer gz]# wget http://apache.bestwebcover.com/jakarta/tomcat-5/v5.5.4/bin/jakarta-tomcat-5.5.4-fulldocs.tar.gz &
[root@LinuxServer gz]# cd /usr/local/
[root@LinuxServer local]# gunzip < /root/gz/jakarta-tomcat-5.5.4-admin.tar.gz | tar xf -
[root@LinuxServer local]# gunzip < /root/gz/jakarta-tomcat-5.5.4-deployer.tar.gz | tar xf -
[root@LinuxServer local]# gunzip < /root/gz/jakarta-tomcat-5.5.4-embed.tar.gz | tar xf -
[root@LinuxServer local]# gunzip < /root/gz/jakarta-tomcat-5.5.4-fulldocs.tar.gz | tar xf -
好,现在您用的tomcat是完整版的了!
6.     至此,Linux上tomcat安装完毕。

你可能感兴趣的:(Tomcat,Linux,Apache,J2SE,浏览器)