ubuntu 设置自动tomcat
安装 tomcat 就不说了,比较简单
1
sudo mv apache-tomcat-6.0.14 /usr/local/tomcat
2
vi ~/.bashrc
添加下边到末尾
export JAVA_HOME=/usr/lib/jvm/java-6-sun
3
sudo vi /etc/init.d/tomcat
拷贝下边
# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid
export JAVA_HOME=/usr/lib/jvm/java-6-sun
case $1 in
start)
sh /usr/local/tomcat/bin/startup.sh
;;
stop)
sh /usr/local/tomcat/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat/bin/shutdown.sh
sh /usr/local/tomcat/bin/startup.sh
;;
esac
exit 0
4 #
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid
export JAVA_HOME=/usr/lib/jvm/java-6-sun
case $1 in
start)
sh /usr/local/tomcat/bin/startup.sh
;;
stop)
sh /usr/local/tomcat/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat/bin/shutdown.sh
sh /usr/local/tomcat/bin/startup.sh
;;
esac
exit 0
创建链接
sudo chmod 755 /etc/init.d/tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat
由于ubuntu 无法安装 jdk 1.6
我安装时其实用的是 jdk1.5 的
根据jdk 版本改一下
export JAVA_HOME=/usr/lib/j2sdk1.5-sun
基本都是根据
http://www.howtogeek.com/howto/linux/installing-tomcat-6-on-ubuntu/
改了一点东西
配置完成后重新启动。
打开 localhost:8080
能看到小猫的话就正常了。。