Tomcat 7 on CentOS 7
This post provides a basic installation and configuration of Tomcat 7 on a CentOS 7 server. These steps will install the latest release of Tomcat that is available in the repository.
Using yum we can install the tomcat package:
# sudo yum install tomcat tomcat-webapps tomcat-admin-webapps
The above command will install tomcat version 7 and all it's dependancies, the default root page, the web application manager and virtual host manager.
NOTE:Answer y when prompted to install tomcat.
Also, during installation the user
tomcat is created.
By default tomcat files are located under /usr/share/tomcat. You can drop your tomcat applications into the
webapps directory under the default location.
If you need the tomcat documentation, use:
sudo yum install tomcat-javadoc tomcat-docs-webapp
To start tomcat use
# sudo systemctl start tomcat
If tomcat is already running, just simply restart it:
# sudo systemctl restart tomcat
If you want tomcat to run everytime the server is booted, you will need to enable the service:
# sudo systemctl enable tomcat
Configure tomcat manager webapp
To use the tomcat web management interface previously installed we must add a login to the tomcat server. The simplest method is to edit the
# sudo namo /usr/share/tomcat/conf/tomcat-users.xml
In this example we will add a user that can access the manager-gui and admin-gui. Locate the section
<tomcat-users>. For example:
<tomcat-users> <user username="admin" password="admin" roles="manager-gui,admin-gui"/> </tomcat-users>
Change the 'username' and 'password' to match your desired entries. Save and exit the file. Restart the tomcat service
Access the web interface
Now that we have configured and restarted tomcat, we can access the manager webapp in your web browser. Simply point the browser at the IP address of the server with port 8080
To access the host manager, point your web browser at the the following:
You now have a running tomcat environment and you can deply your web apps.