#debian 7.7 系统最小化安装
#install jdk
tar xzvf jdk-7u71-linux-x64.tar.gz
mv jdk1.7.0_71 /usr/local/
ln -s /usr/local/jdk1.7.0_71 /usr/local/java
vim /etc/profile
export JAVA_HOME=/usr/local/java
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JRE_HOME=$JAVA_HOME/jre
source /etc/profile
#验证java版本
java -version
#install tomcat
tar xzvf apache-tomcat-7.0.56.tar.gz
mv apache-tomcat-7.0.56 /usr/local/
ln -s /usr/local/apache-tomcat-7.0.56 /usr/local/tomcat
vim /etc/profile
export TOMCAT_HOME=/usr/local/tomcat/
export CATALINA_HOME=/usr/local/tomcat/
export CATALINA_BASE=/usr/local/tomcat/
export CATALINA_TMPDIR=/usr/local/tomcat/temp
source /etc/profile
#start tomcat
/usr/local/tomcat/bin/startup.sh
#设置tomcat开机自启动
cat /etc/rc.local
su - root -c "/usr/local/tomcat/bin/startup.sh"
#将tomcat制作成系统服务
cp /usr/local/tomcat/bin/catalina.sh /etc/init.d/tomcat
vim /etc/init.d/tomcat
#在开头增加如下内容
#!/bin/sh
### BEGIN INIT INFO
# Provides: tomcat
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: start tomcat server
### END INIT INFO
JAVA_HOME=/usr/local/java
CATALINA_HOME=/usr/local/tomcat
chkconfig tomcat on
#tomcat-users.xml 配置
<tomcat-users>
<!--
NOTE: By default, no user is included in the "manager-gui" role required
to operate the "/manager/html" web application. If you wish to use this app,
you must define such a user - the username and password are arbitrary.
-->
<!--
NOTE: The sample user and role entries below are wrapped in a comment
and thus are ignored when reading this file. Do not forget to remove
<!.. ..> that surrounds them.
-->
<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="admin"/>
<role rolename="admin-gui"/>
<user username="tomcat" password="tomcat" roles="admin-gui,admin,manager-gui,manager"/>
</tomcat-users>