Apache Tomcat is an open source implementation of the Java Servlet and Java Server Pages. To install Apache Tomcat on CentOS 7, run
yum install tomcat
To enable tomcat start on boot
systemctl enable tomcat
You can manage tomcat with
systemctl stop tomcat systemctl start tomcat systemctl status tomcat systemctl restart tomcat
To see the ports used by tomcat
[root@tomcat ~]# netstat -lntp| grep java tcp6 0 0 127.0.0.1:8005 :::* LISTEN 31423/java tcp6 0 0 :::8009 :::* LISTEN 31423/java tcp6 0 0 :::8080 :::* LISTEN 31423/java [root@tomcat ~]#
webapps are stored in the directory
/var/lib/tomcat/webapps
Create the default page with
mkdir /var/lib/tomcat/webapps/ROOT echo "Hello Cat" > /var/lib/tomcat/webapps/ROOT/index.html
Tomcat web server can be accessed using
http://your-server-ip:8080
To open 8080 port on the firewall, use commands
firewall-cmd --permanent --zone=public --add-port=8080/tcp firewall-cmd --reload
Tomcat configurations are available in the directory.
/etc/tomcat/
Install tomcat Manager
To install the Tomcat manager GUI application, run
yum install tomcat-admin-webapps.noarch -y
To create user, edit file
vi /etc/tomcat/tomcat-users.xml
Inside “
USER_NAME_HERE and PW_HERE – replace with the username and password you need.
Restart tomcat to activate Tomcat Manager GUI.
systemctl restart tomcat
To access GUI, go to
http://your-server-ip-here:8080/manager/