- 在tomcat-users.xml中添加了以下代码即可
- <role rolename="tomcat"/>
- <role rolename="role1"/>
- <role rolename="manager-gui"/>
- <user username="tomcat" password="tomcat" roles="tomcat,manager-gui"/>
- <user username="both" password="tomcat" roles="tomcat,role1"/>
- <user username="role1" password="tomcat" roles="role1"/>
配置tomcat 开启启动:
1. cd /etc/init.d
2. sudo vi tomcat6
#!/bin/sh ### BEGIN INIT INFO # Provides: tomcat # Required-Start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts the tomcat web server # Description: starts tomcat using start-stop-daemon ### END INIT INFO #tomcat auto-start export JAVA_HOME="/usr/lib/jvm/jdk1.7.0_21" export CATALINA_HOME="/home/ubuntu/tomcat6" case $1 in start) sh /home/ubuntu/tomcat6/bin/startup.sh ;; stop) sh /home/ubuntu/tomcat6/bin/shutdown.sh ;; restart) sh /home/ubuntu/tomcat6/bin/shutdown.sh sh /home/ubuntu/tomcat6/bin/startup.sh ;; *) echo 'Usage:tomcat6 start|stop|restart' ;; esac exit 0
3. 设置为可执行:sudo chmod +x tomcat6
4. 加入自启动任务:sudo update-rc.d tomcat6 defaults