First let install tomcat6 so we have some template from where to copy the scripts:
0) yum install tomcat6
Now lets configure the service:
1) cp -R /etc/init.d/tomcat6 /etc/init.d/tomcat7
2) Edit /etc/init.d/tomcat7 and change all occurrences of
tomcat6 to
tomcat7Now lets configure the script that actually starts the tomcat:
3) cp -R /usr/sbin/tomcat6 /usr/sbin/tomcat7
4) Edit /usr/sbin/tomcat7 and change all occurrences of
tomcat6 to
tomcat7Next let's make the configuration & log directories:
5) mkdir /etc/tomcat7
6) mkdir /var/log/tomcat7
Now download the tomcat archive distribution:
7) Download tomcat7.tar.gz and extract it into /usr/share/tomcat7
Copy the configuration files in Fedora standart config dir:
8) cp -R /usr/share/tomcat7/conf /etc/tomcat7
9) rm -Rf /usr/share/tomcat7/conf
10) ln -s /etc/tomcat7 /usr/share/tomcat7/conf
Make the tomcat7 to use the standard Fedora log directory:
11) rm -Rf /usr/share/tomcat7/logs
12) ln -s /var/log/tomcat7 /usr/share/tomcat7/logs
Configure the tomcat7 options:
13) cp /etc/tomcat6/tomcat6.conf /etc/tomcat7/tomcat7.conf
14) Edit /etc/tomcat7/tomcat7.conf and change all occurrences of
tomcat6 to
tomcat7Specify temp & work dirs:
15) mkdir -p /var/cache/tomcat7/work
16) mkdir -p /var/cache/tomcat7/temp
17) rm -Rf /usr/share/tomcat7/work
18) rm -Rf /usr/share/tomcat7/temp
19) ln -s /var/cache/tomcat7/work /usr/share/tomcat7/work
20) ln -s /var/cache/tomcat7/temp /usr/share/tomcat7/temp
Fix the permissions:
21) chgrp -R tomcat /usr/share/tomcat7
22) chmod -R ug+rwx /usr/share/tomcat7
23) chgrp -R tomcat /var/log/tomcat7
24) chmod -R ug+rwx /var/log/tomcat7
25) chgrp -R tomcat /var/cache/tomcat7
26) chmod -R ug+rwx /var/cache/tomcat7
Add administrator user so you can manage the server:
27) Edit /etc/tomcat7/tomcat7.conf and following lines
<role rolename="admin"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user name="admin" password="adminadmin" roles="admin,manager,admin-gui,admin-script,manager-gui,manager-script,manager-jmx,manager-status" />
Now start the service and everything should works fine:
28) service tomcat7 start
Finally you can start the service on everyboot
29) chkconfig tomcat7 on