Tomcat7 install

apt-get install tomcat7

apt-get install tomcat7 tomcat7-docs tomcat7-examples tomcat7-admin tomcat7-user

Created for you:
Creating config file /etc/default/tomcat7 with new version
Adding system user `tomcat7' (UID 107) …
Adding new user `tomcat7' (UID 107) with group `tomcat7' …

apt-get install tomcat7-docs tomcat7-examples tomcat7-admin tomcat7-user

# find / -name "tomcat-users.xml"
There will be 2 tomcat-users.xml
• /etc/tomcat7/tomcat-users.xml is for the site created on port 8080
• /usr/share/tomcat7/skel/conf/tomcat-users.xml is the default used for create instance.

vi /etc/tomcat7/tomcat-users.xml
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="user" password="password" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script"/>

Restart tomcat:
/etc/init.d/tomcat7 restart

CD to the directory where you want to put the new instance.
mkdir /etc/tomcat7inst
cd /etc/tomcat7inst

tomcat7-instance-create -p 8100 -c 8105 810
You are about to create a Tomcat instance in directory '810'
* New Tomcat instance created in 810
* You might want to edit default configuration in 810/conf
* Run 810/bin/startup.sh to start your Tomcat instance

Modify/verify

/etc/tomcat7inst/810/conf/server.xml
<Server port="8105" shutdown="SHUTDOWN">
<Connector port="8100" protocol="HTTP/1.1"
<Connector port="8109" protocol="AJP/1.3" redirectPort="8443" />

Modify/verify

/etc/tomcat7inst/810/conf/ tomcat-users.xml (same as above).

To get ROOT app
cp -r /var/lib/tomcat7/webapps/ROOT/ /etc/tomcat7inst/810/webapps/
Restart tomcat:

./810/bin/shutdown.sh
./810/bin/startup.sh
/etc/init.d/tomcat7 restart

To get manager sites to work
cp /etc/tomcat7/Catalina/localhost/* /etc/tomcat7inst/810/conf/Catalina/localhost/
Restart tomcat:

./810/bin/shutdown.sh
./810/bin/startup.sh
/etc/init.d/tomcat7 restart


When doing a deploy, be sure to cleanup…
rm -rf /etc/tomcat7inst/810/work/Catalina/
rm –rf /etc/tomcat7inst/810/temp/


Tag Cloud