Procedure
- Download from http://tomcat.apache.org/download-70.cgi or http://tomcat.apache.org/download-60.cgi the latest release version of Tomcat and extract the zip or tar.gz file into a new directory.
-
Have an environment variable $CATALINA_HOME point to your
expanded Tomcat application directory, e.g. for Linux (in your
~/.bashrc file):
export CATALINA_HOME=/usr/myapps/tomcat-<version>
-
In the
CATALINA_HOME/conf/tomcat-users.xml file,
we'll need to create a user with appropriate manager permissions.
Create a new user with the role of manager-script or
give the default "tomcat" user the manager-script role as shown below.
This role allows for deploying web applications using scripting
tools such as the Tomcat Maven Plugin we're using in this
tutorial. Although not necessary for Tomcat deployment, The
manager-gui role gives ability to access the browser-based Tomcat
Manager HTML application, helpful for a quick authentication
check. Depending on your security needs, you may or may not wish
to do this in production.
<tomcat-users> ...other entries... <role rolename="manager-script"/> <role rolename="manager-gui"/> <user username="tomcat" password="????" roles="tomcat,manager-script,manager-gui"/> </tomcat-users>
Warning: For production it is best to grant manager roles to another username besides the easy-to-guess default "tomcat" user.Change the "????" in user password line of tomcat-users configuration to another appropriate password and save. -
Start Tomcat from a console window:
{prompt}% $CATALINA_HOME/bin/startup.sh
-
If you granted the user the
manager-gui
role, confirm that you can log into the manager webapp at http://localhost:8080/manager/html using the username and password of the manager account.