linux 系统下配置tomcat,并给tomcat赋予最高操作权限,启动tomcat和关闭tomcat

配置tomcat服器

sudo chmod -R 777 * 给某个文件下所有文件赋予最高的读写权限

红颜色的字是路径,蓝颜色字是命令

(1)官方网站下载tomcat压缩包。apache-tomcat-7.0.57.tar.gz

(2)进入你指定的tomact目录下,将压缩包放入该目录下,利用命令解压该压缩包。

    命令:sudo tar apache-tomcat-7.0.57.tar.gz
(3)该tomcat能否运行的前提是,你已经在linux系统环境下成功配置了jdk环境

(4)由于权限问题,可能不能启动tomcat。因此要给该tomcat赋予最高权限

    命令:进入到tomcat的安装目录,运行命令/user/java/tomcat$ sudo chmod 777 *
       进入到tomcat的安装目录的下一层,运行命令: /user/java/tomcat/apache-tomcat-7.0.57$ sudo chmod 777 *
       进入到tomcat的安装目录的bin目录,运行命令:/user/java/tomcat/apache-tomcat-7.0.57/bin$ sudo chmod 777 * 
       进入到tomcat的安装目录的conf目录,运行命令:/user/java/tomcat/apache-tomcat-7.0.57/conf$ sudo chmod 777 *
       进入到tomcat的安装目录的lib目录,运行命令:/user/java/tomcat/apache-tomcat-7.0.57/lib$ sudo chmod 777 *
       进入到tomcat的安装目录的logs目录,运行命令:/user/java/tomcat/apache-tomcat-7.0.57/logs$ sudo chmod 777 *
(5)启动tomcat服务器:进入到tomcat的安装目录的bin目录,运行命令:/user/java/tomcat/apache-tomcat-7.0.57/bin$ ./startup.sh
    启动的提示信息:

Using CATALINA_BASE:   /home/shangxiaofei/user/java/tomcat/apache-tomcat-7.0.57
Using CATALINA_HOME:   /home/shangxiaofei/user/java/tomcat/apache-tomcat-7.0.57
Using CATALINA_TMPDIR: /home/shangxiaofei/user/java/tomcat/apache-tomcat-7.0.57/temp
Using JRE_HOME:        /home/shangxiaofei/user/java/jdk/jdk1.7.0_71
Using CLASSPATH:       /home/shangxiaofei/user/java/tomcat/apache-tomcat-7.0.57/bin/bootstrap.jar:/home/shangxiaofei/user/java/tomcat/apache-tomcat-7.0.57/bin/tomcat-juli.jar
Tomcat started.

(6)查看tomcat是否启动成功。进入到tomcat的安装目录的logs目录下,运行命令。启动成功,网址输入(在没有改变tomcat默认端口号8080的情况下)locathost:8080即可测试。

shangxiaofei@shangxiaofei-VirtualBox:~/user/java/tomcat/apache-tomcat-7.0.57/bin$ cd ../logs
shangxiaofei@shangxiaofei-VirtualBox:~/user/java/tomcat/apache-tomcat-7.0.57/logs$ tail -f catalina.out

提示成功的信息:
一月 21, 2015 7:23:56 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory /home/shangxiaofei/user/java/tomcat/apache-tomcat-7.0.57/webapps/examples
一月 21, 2015 7:23:57 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory /home/shangxiaofei/user/java/tomcat/apache-tomcat-7.0.57/webapps/examples has finished in 546 ms
一月 21, 2015 7:23:57 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]
一月 21, 2015 7:23:57 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-8009"]
一月 21, 2015 7:23:57 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 1920 ms

(7)关闭tomcat服务器:进入到tomcat的安装目录的bin目录下,运行命令:~/user/java/tomcat/apache-tomcat-7.0.57/bin$ ./shutdown.sh

关闭的提示信息:

Using CATALINA_BASE:   /home/shangxiaofei/user/java/tomcat/apache-tomcat-7.0.57
Using CATALINA_HOME:   /home/shangxiaofei/user/java/tomcat/apache-tomcat-7.0.57
Using CATALINA_TMPDIR: /home/shangxiaofei/user/java/tomcat/apache-tomcat-7.0.57/temp
Using JRE_HOME:        /home/shangxiaofei/user/java/jdk/jdk1.7.0_71
Using CLASSPATH:       /home/shangxiaofei/user/java/tomcat/apache-tomcat-7.0.57/bin/bootstrap.jar:/home/shangxiaofei/user/java/tomcat/apache-tomcat-7.0.57/bin/tomcat-juli.jar

上一篇:webpack插件自动加css3前缀


下一篇:Target runtime Apache Tomcat v6.0 is not defined