official download page<\/a>, which is 8.0.33 as of writing.<\/p>\n\n\n\nUnder the “Binary Distributions” section and then the “Core” list, use the link pointing to the “tar.gz” archive to compose a wget command:<\/p>\n\n\n\n
cd ~\n\nwget http:\/\/www-us.apache.org\/dist\/tomcat\/tomcat-8\/v8.0.33\/bin\/apache-tomcat-8.0.33.tar.gz\n\nsudo tar -zxvf apache-tomcat-8.0.33.tar.gz -C \/opt\/tomcat --strip-components=1\n<\/code><\/pre>\n\n\n\nStep 5: Setup proper permissions<\/h2>\n\n\n\n
Before you can run Apache Tomcat, you need to setup proper permissions for several directories:<\/p>\n\n\n\n
cd \/opt\/tomcat\n\nsudo chgrp -R tomcat conf\n\nsudo chmod g+rwx conf\n\nsudo chmod g+r conf\/*\n\nsudo chown -R tomcat logs\/ temp\/ webapps\/ work\/\n\n\n\nsudo chgrp -R tomcat bin\n\nsudo chgrp -R tomcat lib\n\nsudo chmod g+rwx bin\n\nsudo chmod g+r bin\/*\n<\/code><\/pre>\n\n\n\nStep 6: Setup a Systemd unit file for Apache Tomcat<\/h2>\n\n\n\n
As a matter of convenience, you should setup a Systemd unit file for Apache Tomcat:<\/p>\n\n\n\n
sudo vi \/etc\/systemd\/system\/tomcat.service\n<\/code><\/pre>\n\n\n\nPopulate the file with:<\/p>\n\n\n\n
[Unit]\n\nDescription=Apache Tomcat Web Application Container\n\nAfter=syslog.target network.target\n\n\n\n[Service]\n\nType=forking\n\n\n\nEnvironment=JAVA_HOME=\/usr\/lib\/jvm\/jre\n\nEnvironment=CATALINA_PID=\/opt\/tomcat\/temp\/tomcat.pid\n\nEnvironment=CATALINA_HOME=\/opt\/tomcat\n\nEnvironment=CATALINA_BASE=\/opt\/tomcat\n\nEnvironment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'\n\nEnvironment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:\/dev\/.\/urandom'\n\n\n\nExecStart=\/opt\/tomcat\/bin\/startup.sh\n\nExecStop=\/bin\/kill -15 $MAINPID\n\n\n\nUser=tomcat\n\nGroup=tomcat\n\n\n\n[Install]\n\nWantedBy=multi-user.target\n<\/code><\/pre>\n\n\n\nSave and quit:<\/p>\n\n\n\n
:wq\n<\/code><\/pre>\n\n\n\nFor security purposes, you should install haveged as well:<\/p>\n\n\n\n
sudo yum install haveged\n\nsudo systemctl start haveged.service\n\nsudo systemctl enable haveged.service\n<\/code><\/pre>\n\n\n\nStep 8: Start and test Apache Tomcat<\/h2>\n\n\n\n
Now, start the Apache Tomcat service and set it run on system boot:<\/p>\n\n\n\n
sudo systemctl start tomcat.service\n\nsudo systemctl enable tomcat.service\n<\/code><\/pre>\n\n\n\nIn order to test Apache Tomcat in a web browser, you need to modify the firewall rules:<\/p>\n\n\n\n
sudo firewall-cmd --zone=public --permanent --add-port=8080\/tcp\n\nsudo firewall-cmd --reload\n<\/code><\/pre>\n\n\n\nThen, you can test your installation of Apache Tomcat by visiting the following URL from a web browser:<\/p>\n\n\n\n
http://[your-Vultr-server-IP]:8080\n<\/code><\/pre>\n\n\n\nIf nothing goes wrong, you will see the default Apache Tomcat front page.<\/p>\n\n\n\n
In order to use the “Manager App” and the “Host manager” in the Apache Tomcat web interface, you need to create an admin user for your Apache Tomcat server:<\/p>\n\n\n\n
sudo vi \/opt\/tomcat\/conf\/tomcat-users.xml\n<\/code><\/pre>\n\n\n\nWithin the <\/tomcat-users ...>...<\/tomcat-users><\/code> segment, insert a line to define a admin user:<\/p>\n\n\n\n<user username=\"yourusername\" password=\"yourpassword\" roles=\"manager-gui,admin-gui\"\/>\n<\/code><\/pre>\n\n\n\nRemember to replace “yourusername” and “yourpassword” with your own ones, the less common the better.<\/p>\n\n\n\n
Save and quit:<\/p>\n\n\n\n
:wq\n<\/code><\/pre>\n\n\n\nRestart Apache Tomcat to put your modifications into effect:<\/p>\n\n\n\n
sudo systemctl restart tomcat.service\n<\/code><\/pre>\n\n\n\nRefresh the Apache Tomcat front page from your web browser. Log in the “Manager App” and the “Host manager” using the credentials you had setup earlier.<\/p>\n\n\n\n
The Apache Tomcat setup is complete. You can now use it to deploy your own applications.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","manualknowledgebasecat":[109,231,242],"manual_kb_tag":[],"_links":{"self":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/3754"}],"collection":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/comments?post=3754"}],"version-history":[{"count":2,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/3754\/revisions"}],"predecessor-version":[{"id":3758,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/3754\/revisions\/3758"}],"wp:attachment":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/media?parent=3754"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manualknowledgebasecat?post=3754"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb_tag?post=3754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}