首页 > 代码库 > Centos服务器搭建(2)——安装tomcat

Centos服务器搭建(2)——安装tomcat

首先已经安装完JDK

1.下载apache-tomcat-7.0.57.tar.gz

2.复制到/opt 解压

[root@iZ2873rjubzZ opt]# cp /root/apache-tomcat-7.0.57.tar.gz /opt/[root@iZ2873rjubzZ opt]# tar -xzvf apache-tomcat-7.0.57.tar.gz

3. 设置环境变量

[root@iZ2873rjubzZ opt]# vi /etc/profile##shift+g定位到文件末尾,添加以下代码export CATALINA_HOME=/opt/apache-tomcat-7.0.57
export JAVA_HOME PATH CLASSPATH
##执行以下命令让配置文件生效
[root@iZ2873rjubzZ opt]# source /etc/profile

4.启动tomcat

[root@iZ2873rjubzZ opt]# apache-tomcat-7.0.57/bin/startup.shUsing CATALINA_BASE:   /opt/apache-tomcat-7.0.57Using CATALINA_HOME:   /opt/apache-tomcat-7.0.57Using CATALINA_TMPDIR: /opt/apache-tomcat-7.0.57/tempUsing JRE_HOME:        /opt/jdk1.7.0_51Using CLASSPATH:       /opt/apache-tomcat-7.0.57/bin/bootstrap.jar:/opt/apache-tomcat-7.0.57/bin/tomcat-juli.jarTomcat started.

通过http://localhost:8080 访问有没有启动成功

5. 关闭tomcat

[root@iZ2873rjubzZ opt]# apache-tomcat-7.0.57/bin/shutdown.shUsing CATALINA_BASE:   /opt/apache-tomcat-7.0.57Using CATALINA_HOME:   /opt/apache-tomcat-7.0.57Using CATALINA_TMPDIR: /opt/apache-tomcat-7.0.57/tempUsing JRE_HOME:        /opt/jdk1.7.0_51Using CLASSPATH:       /opt/apache-tomcat-7.0.57/bin/bootstrap.jar:/opt/apache-tomcat-7.0.57/bin/tomcat-juli.jar[root@iZ2873rjubzZ opt]#

至此 tomcat已经安装完成

 

Centos服务器搭建(2)——安装tomcat