$ su -
$ wget http://apache.tt.co.kr/tomcat/tomcat-7/v7.0.42/bin/apache-tomcat-7.0.42.tar.gz
$ tar xvzf apache-tomcat-7.0.42.tar.gz
$ mv apache-tomcat-7.0.42 /usr/local/
$ ln -s apache-tomcat-7.0.42 tomcat7
$ useradd tomcat
$ chown -R tomcat.tomcat tomcat7
$ touch /etc/init.d/tomcat7
$ chmod 755 /etc/init.d/tomcat7
$ chkconfig --level 2345 --add tomcat7
$ chkconfig --list tomcat7
#!/bin/sh
JAVA_HOME=/usr/local/java
CATALINA_HOME=/usr/local/tomcat7
export JAVA_HOME CATALINA_HOME
CATALINA_BASE=$CATALINA_HOME
CATALINA_TMPDIR=$CATALINA_HOME/temp
# chkconfig: 2345 99 99
# description: Tomcat7 servlet engine
#
### BEGIN INIT INFO
# Provides: Tomcat7
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Description:
### END INIT INFO
set -e
NAME=tomcat7
DESC="Tomcat servlet engine"
if [ `id -u` -ne 0 ]; then
echo "You need root privileges to run this script"
exit 1
fi
case $1 in
start)
$CATALINA_HOME/bin/startup.sh
;;
stop)
$CATALINA_HOME/bin/shutdown.sh
;;
restart)
$CATALINA_HOME/bin/shutdown.sh
$CATALINA_HOME/bin/startup.sh
;;
esac
exit 0
/conf/tomcat-users.xml
<tomcat-users>
<role rolename="admin-gui" />
<role rolename="manager-gui" />
<role rolename="manager-jmx" />
<user username="tomcat" password="tomcat" roles="admin-gui, manager-gui" />
<user username="manager" password="manager" roles="manager-jmx" />
</tomcat-users>
check manual: http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html The HTML interface is protected against CSRF but the text and JMX interfaces are not. To maintain the CSRF protection:
Users with the manager-gui role should not be granted either the manager-script or manager-jmx roles. If the text or jmx interfaces are accessed through a browser (e.g. for testing since these interfaces are intended for tools not humans) then the browser must be closed afterwards to terminate the session.
/conf/server.xml
<Connector executor="tomcatThreadPool"
port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol" connectionTimeout="20000" redirectPort="8443" />
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="/usr/local/tomcat7/conf/keystore" keystorePass="tomcat7" />
$ keytool -genkey -alias tomcat7 -keyalg RSA -keystore /usr/local/tomcat7/conf/keystore
sudo ./configure --with-apr=/usr/bin/apr-1-config --with-java-home=/usr/local/java/ --with-ssl=/usr/lib64/openssl/
sudo make
sudo make install
- before: <Connector protocol="HTTP/1.1" .. />
- after: <Connector protocol="org.apache.coyote.http11.Http11AprProtocol" .. />
CATALINA_OPTS="$CATALINA_OPTS -Djava.library.path=/usr/local/apr/lib/"
https://wiki.jenkins-ci.org/display/JENKINS/Tomcat
$ wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war
$ mv jenkins.war /usr/local/tomcat7/webapps/
$ useradd -g tomcat jenkins
CATALINA_OPTS="$CATALINA_OPTS -Djava.library.path=/usr/local/apr/lib/ -DJENKINS_HOME=/home/jenkins/"
<role rolename="admin" />
<role rolename="admin-gui" />
<role rolename="manager-gui" />
<role rolename="manager-jmx" />
<user username="tomcat" password="tomcat" roles="admin, admin-gui,manager-gui" />
<user username="manager" password="manager" roles="manager-jmx" />
"Could not intialize the host network interface on nullbecause of an error"
CATALINA_OPTS="$CATALINA_OPTS -Djava.library.path=/usr/local/apr/lib/ -DJENKINS_HOME=/home/jenkins/ -Dhudson.DNSMultiCast.disabled=true"
- Controlling features of Hudson using system properties
- http://wiki.eclipse.org/Features_controlled_by_system_properties