1. 安装:
devadm@devserver:~$ sudo tasksel |
选择 [*] Tomcat Java server.
2. 安装完毕后:
devadm@devserver:~$ sudo service tomcat6 status * Tomcat servlet engine is running with pid 2619 devadm@devserver:~$ |
3. 参考 http://wiki.ubuntu.org.cn/Tomcat6 ,运行 startup.sh,得先找到在哪:
devadm@devserver:~$ sudo find /usr | grep startup.sh /usr/share/tomcat6/bin/startup.sh devadm@devserver:~$ |
运行startup.sh
devadm@devserver:~$ sudo /usr/share/tomcat6/bin/startup.sh Using CATALINA_BASE: /usr/share/tomcat6 Using CATALINA_HOME: /usr/share/tomcat6 Using CATALINA_TMPDIR: /usr/share/tomcat6/temp Using JRE_HOME: /usr Using CLASSPATH: /usr/share/tomcat6/bin/bootstrap.jar touch: cannot touch `/usr/share/tomcat6/logs/catalina.out': No such file or directory /usr/share/tomcat6/bin/catalina.sh: 503: cannot create /usr/share/tomcat6/logs/catalina.out: Directory nonexistent devadm@devserver:~$ |
出错了,解决它!
devadm@devserver:~$ sudo ls -l /usr/share/tomcat6 total 16 drwxr-xr-x 2 root root 4096 2012-01-29 19:05 bin -rw-r--r-- 1 root root 39 2011-09-15 17:46 defaults.md5sum -rw-r--r-- 1 root root 1960 2011-09-15 17:46 defaults.template drwxr-xr-x 2 root root 4096 2012-01-29 19:05 lib devadm@devserver:~$ sudo mkdir /usr/share/tomcat6/logs devadm@devserver:~$ |
再运行startup.sh
devadm@devserver:~$ sudo /usr/share/tomcat6/bin/startup.sh Using CATALINA_BASE: /usr/share/tomcat6 Using CATALINA_HOME: /usr/share/tomcat6 Using CATALINA_TMPDIR: /usr/share/tomcat6/temp Using JRE_HOME: /usr Using CLASSPATH: /usr/share/tomcat6/bin/bootstrap.jar devadm@devserver:~$ |
OK!
4. 别忘了还有防火墙:
devadm@devserver:~$ sudo ufw allow 8080/tcp |
5. 浏览器输入地址: http://devserver:8080
It works! 好用了!
tomcat6-docs 链接好用。
tomcat6-examples链接大部分好用。
tomcat6-admin 的两个链接需要输入用户名/密码,稍后再弄。