1、配置完成后
2、执行:source /etc/profile
3、启动Tomcat服务器,tomcat对应的bin下面执行:./startup.sh(启动/关闭命令:http://www.cnblogs.com/tovep/articles/2473147.html)
4、在浏览器中输入:http://服务器IP:8080。正确打开则表明tomcat启动成功
5、设置Tomcat开机自启项
6、编写开机自启项脚本,该脚本以UTF-8保存,保存为tomcat文件:
#!/bin/sh
# tomcat: Start/Stop/Restart tomcat
# chkconfig: 2345 40 20
# description: Tomcat is a Java Servlet Container
# match these values to your environment:
export CATALINA_BASE=/opt/apache-tomcat-7.0.77
export CATALINA_HOME=$CATALINA_BASE
export CATALINA_TMPDIR=$CATALINA_BASE/temp
export JRE_HOME=/opt/jdk1.8.0_131
# Source function library.
start() {
echo -n "Starting Tomcat: "
$CATALINA_BASE/bin/startup.sh start
}
stop() {
echo -n "Stopping Tomcat: "
$CATALINA_BASE/bin/shutdown.sh stop
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 2
start
;;
*)
echo "Usage: $0 {start stop restart}" ;;
esac
exit $RETVAL
7、将该文件通过WinSCP放到服务器的/tmp文件中
8、通过命令:mv /tmp/tomcat /etc/init.d/ 将tomcat文件移到init.d文件中
9、tomcat/bin 目录下,通过命令:chmod a+x /etc/init.d/tomcat 给所有人提供执行tomcat的权限
10、tomcat/bin 目录下, 通过命令:chown root:root /etc/init.d/tomcat 切换tomcat对应的用户
11、tomcat/bin 目录下, 执行命令:sysv-rc-conf
若没有安装,根据提示安装
若已安装,则操作tomcat对应的选项
12、编辑完成后,按q退出该页面