ubuntu服务器下tomcat安装(不推荐使用apt-get)
最近在阿里云服务器上装tomcat,一开始为了省事直接使用了apt-get安装,结果整个程序被拆开散到了好多地方,尤其是像网上说要把打包好了.war文件放到webapps文件夹下,但是开始并没有在/usr的相关目录下找到,即使后面找到了相关文件,但是等到运行/startup.sh的时候却发现在日志文件里出现了下面的内容:
Dec 23, 2017 11:44:02 AM org.apache.catalina.startup.Catalina initDirs SEVERE: Cannot find specified temporary folder at /usr/share/tomcat8/temp Dec 23, 2017 11:44:02 AM org.apache.catalina.startup.Catalina load WARNING: Unable to load server configuration from [/usr/share/tomcat8/conf/server.xml] Dec 23, 2017 11:44:02 AM org.apache.catalina.startup.Catalina initDirs SEVERE: Cannot find specified temporary folder at /usr/share/tomcat8/temp Dec 23, 2017 11:44:02 AM org.apache.catalina.startup.Catalina load WARNING: Unable to load server configuration from [/usr/share/tomcat8/conf/server.xml] Dec 23, 2017 11:44:02 AM org.apache.catalina.startup.Catalina start SEVERE: Cannot start server. Server instance is not configured. Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.ClassLoaderFactory validateFile WARNING: Problem with directory [/usr/share/tomcat8/common/classes], exists: [false], isDirectory: [false], canRead: [false] Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.ClassLoaderFactory validateFile WARNING: Problem with directory [/usr/share/tomcat8/common], exists: [false], isDirectory: [false], canRead: [false] Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.ClassLoaderFactory validateFile WARNING: Problem with directory [/usr/share/tomcat8/server/classes], exists: [false], isDirectory: [false], canRead: [false] Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.ClassLoaderFactory validateFile WARNING: Problem with directory [/usr/share/tomcat8/server], exists: [false], isDirectory: [false], canRead: [false] Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.ClassLoaderFactory validateFile WARNING: Problem with directory [/usr/share/tomcat8/shared/classes], exists: [false], isDirectory: [false], canRead: [false] Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.ClassLoaderFactory validateFile WARNING: Problem with directory [/usr/share/tomcat8/shared], exists: [false], isDirectory: [false], canRead: [false] Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.Catalina initDirs SEVERE: Cannot find specified temporary folder at /usr/share/tomcat8/temp Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.Catalina load WARNING: Unable to load server configuration from [/usr/share/tomcat8/conf/server.xml] Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.Catalina initDirs SEVERE: Cannot find specified temporary folder at /usr/share/tomcat8/temp Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.Catalina load WARNING: Unable to load server configuration from [/usr/share/tomcat8/conf/server.xml] Dec 23, 2017 11:46:20 AM org.apache.catalina.startup.Catalina start SEVERE: Cannot start server. Server instance is not configured.
摔,以第四行的server.xml找不到为例,因为apt-get的方法在下载的时候把server.xml放到了/etc/tomcat8里面而startup.sh则放到了/usr/share/tomcat8下,所以实际上根本就没法正常运行,如果要运行就需要改很多地方,所以不如直接删除后放弃,使用别的方式来的更快一些。
不过在这里还是给大家分享一下我找到的apt-get下载的东西都分布在哪里,这样大家到时候如果要删除的话也会更方便(可能不全欢迎大家帮忙补充):
/usr/share/tomcat8
etc/tomcat8 这里主要是一些配置文件(本来etc也是存放配置的)
var/lib/tomcat8/ 这里主要是存放webapps等文件
所以总的来说还是推荐大家去官网下载,也并不大,大概10MB左右,下载下来以后把它上传到服务器上,然后找一个人地方解压就好了,不过这个需要注意解决防火墙问题,输入
/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
即可。