Tag: Tomcat/Tomcat6のCentOS6へのインストール
# ln -s apache-tomcat-6.0.35 tomcat
# useradd -d /var/empty/tomcat -s /sbin/nologin tomcat
# chown -R tomcat.tomcat apache-tomcat-6.0.35
#!/bin/sh # # Startup script for Apache Tomcat 5.5 # # chkconfig: 2345 85 15 # description: Apache Tomcat Java Servlets and JSP server # processname: tomcat # pidfile: /var/run/tomcat.pid # config: /usr/local/tomcat/conf/server.xml # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network ###### added here ##### export JAVA_HOME=/usr/java/default export PATH=$JAVA_HOME/bin:$PATH export TOMCAT_HOME=/usr/local/tomcat export CATALINA_HOME=/usr/local/tomcat ###### added here ##### TOMCAT_SCRIPT=$CATALINA_HOME/bin/catalina.sh TOMCAT_USER=tomcat [ -f $TOMCAT_SCRIPT ] || exit 0 # See how we were called. case "$1" in start) # Start daemons. if [ -f /var/lock/subsys/tomcat ] ; then echo "Tomcat already started!" exit 1 fi echo -n "Starting Tomcat: " #/bin/su -s /bin/bash - $TOMCAT_USER -c "$TOMCAT_SCRIPT start" >/tmp/tomcat.log 2>&1 ###### su->runuser by src ##### /sbin/runuser -p -s /bin/bash - $TOMCAT_USER -c "$TOMCAT_SCRIPT start" RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/tomcat ;; stop) # Stop daemons. if [ ! -f /var/lock/subsys/tomcat ] ; then echo "Tomcat already stopped!" exit 1 fi echo -n "Shutting down Tomcat: " $TOMCAT_SCRIPT stop RETVAL=$? echo [ $RETVAL = 0 ] && rm -f /var/lock/subsys/tomcat ;; status) status tomcat exit $? ;; restart) $0 stop $0 start ;; *) echo "Usage: $TOMCAT_PROG {start|stop|status|restart}" exit 1 esac exit 0
# chkconfig --add tomcat
<?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="tomcat"/> <role rolename="role1"/> <role rolename="manager"/> <role rolename="admin"/> <user username="tomcat" password="tomcat" roles="tomcat,manager,admin"/> <user username="role1" password="tomcat" roles="role1"/> <user username="both" password="tomcat" roles="tomcat,role1"/> </tomcat-users>