2.4.3. Running Tomcat
The following procedure outlines the steps to run Tomcat.
Procedure 2.14. Running Tomcat on Red Hat Enterprise Linux
- After extracting the zip file, check to see if a user called
tomcat
exists on the system by running the following command:id tomcat
id tomcat
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - If the user does not exist, use the following command to add it:
groupadd -g 91 -r tomcat useradd -c "Tomcat" -u 91 -g tomcat -s /bin/sh -r tomcat
groupadd -g 91 -r tomcat useradd -c "Tomcat" -u 91 -g tomcat -s /bin/sh -r tomcat
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - If the
tomcat
user will be running Tomcat, change the ownership of the tomcat directories.- Use the following command for Tomcat 6:
chown -R tomcat:tomcat tomcat6
chown -R tomcat:tomcat tomcat6
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Use the following command for Tomcat 7:
chown -R tomcat:tomcat tomcat7
chown -R tomcat:tomcat tomcat7
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
- Test that the
tomcat
user has execution permission to the tomcat install path. - Set the
JAVA_HOME
variable. Use one of the following approaches to set this variable.- Provide the value for
JAVA_HOME
externally by setting the value prior to starting Tomcat.- Set the value for
JAVA_HOME
in thesetenv.sh
file. In Tomcat 6, this file is available attomcat6/bin/
and in Tomcat 7, this file is available attomcat7/bin/
. This value is loaded fromcatalina.sh
and overrides all other set values forJAVA_HOME
.
Start Tomcat
To start Tomcat, execute the following script as the user tomcat
:
sh startup.sh
sh startup.sh
Once the Tomcat service has been started, you can verify that it is running by pointing your web browser to http://localhost:8080.
Stop Tomcat
To stop Tomcat, execute the following script as the user tomcat
:
sh shutdown.sh
sh shutdown.sh