VOOZH about

URL: https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-16-04?comment=48189

โ‡ฑ How To Install Apache Tomcat 8 on Ubuntu 16.04 | DigitalOcean


How To Install Apache Tomcat 8 on Ubuntu 16.04

Updated on July 5, 2018
Not using Ubuntu 16.04?
Choose a different version or distribution.
Ubuntu 16.04
๐Ÿ‘ How To Install Apache Tomcat 8 on Ubuntu 16.04

Introduction

Apache Tomcat is a web server and servlet container that is used to serve Java applications. Tomcat is an open source implementation of the Java Servlet and JavaServer Pages technologies, released by the Apache Software Foundation. This tutorial covers the basic installation and some configuration of the latest release of Tomcat 8 on your Ubuntu 16.04 server.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the author

Former Senior Technical Writer at DigitalOcean, specializing in DevOps topics across multiple Linux distributions, including Ubuntu 18.04, 20.04, 22.04, as well as Debian 10 and 11.

Still looking for an answer?

Was this helpful?

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

To ensure the Tomcat service re-starting at boot, you have to enable it:

$ sudo systemctl enable tomcat

Hello,

For me (in ubuntu 14 (i know this is for ubuntu 16)), in the step 4 : sudo chmod g+r conf/* ==> does not work โ€œNo file or directoryโ€.

Is it normal ?

Thanks for the step by step tomcat installation procedure.

I get error in the step when we start the tomcat service sudo systemctl start tomcat On checking the status by this command - sudo systemctl status tomcat. I see following error - Jun 27 16:09:52 maddy-VirtualBox systemd[6182]: tomcat.service: Failed at step EXEC spawning /opt/tomcat/bin/startup.sh: Permission denied

Although I am logged in as user (which has sudo privileges) still I am getting Permission denied error. I have also changed the ownership of /opt/tomcat/bin directory to the user from which I am firing those commands, still the error is coming.

Can anybody help me in this problem?

Hello, Iโ€™ve got this error and can not shutdown the tomcat properly. Is there a way to solve it?

Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr/lib/jvm/java-8-oracle/jre
Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Jul 06, 2016 5:54:58 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Could not contact localhost:8005. Tomcat may not be running.
Jul 06, 2016 5:54:58 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop:
java.net.ConnectException: Connection refused
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at java.net.Socket.connect(Socket.java:538)
	at java.net.Socket.<init>(Socket.java:434)
	at java.net.Socket.<init>(Socket.java:211)
	at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:476)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:408)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:497)

Thank you.

If you are having problems getting tomcat 8 to start and getting this error

โ— tomcat.service - Apache Tomcat Web Application Container Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Sat 2016-07-30 12:15:27 EDT; 1s ago Process: 13807 ExecStart=/opt/tomcat/bin/startup.sh (code=exited, status=203/EXEC) Jul 30 12:15:27 xxxxxxx systemd[1]: Failed to start Apache Tomcat Web Application Container. Jul 30 12:15:27 xxxxxxx systemd[1]: tomcat.service: Unit entered failed state. Jul 30 12:15:27 xxxxxxxxx systemd[1]: tomcat.service: Failed with result โ€˜exit-codeโ€™.

then you might want to give tomcat user ownership of the whole tomcat directory:

cd /opt && sudo chown -R tomcat tomcat/

Worked for me.

See http://unix.stackexchange.com/questions/235891/tomcat-8-will-not-start-after-initial-install

This comment has been deleted

This comment has been deleted

Hi

Just installed Tomcat 8on Ubuntu 16.04 . Changed the Tomcat-user.xml file too with manager-gui role and changed the password , but I keep getting the 403 Access Denied Page when I click the Manager App from the Tomcat 8

Is there some permissions I have not set ?

Thanks

Hi, i have been trying to figure this out for a week but unable to get Tomcat 8 to start while following this guide.

-- 
-- Unit tomcat.service has failed.
-- 
-- The result is failed.
Aug 22 00:12:17 aimed-ubuntu-blr systemd[1]: tomcat.service: Unit entered failed state.
Aug 22 00:12:17 aimed-ubuntu-blr systemd[1]: tomcat.service: Failed with result 'exit-code'.
Aug 22 00:12:27 aimed-ubuntu-blr systemd[1]: tomcat.service: Service hold-off time over, scheduling restart.
Aug 22 00:12:27 aimed-ubuntu-blr systemd[1]: Stopped Apache Tomcat Web Application Container.
-- Subject: Unit tomcat.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit tomcat.service has finished shutting down.
Aug 22 00:12:27 aimed-ubuntu-blr systemd[1]: Starting Apache Tomcat Web Application Container...
-- Subject: Unit tomcat.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit tomcat.service has begun starting up.
Aug 22 00:12:27 aimed-ubuntu-blr systemd[26177]: tomcat.service: Failed at step EXEC spawning /opt/tomcat/bin/startup.sh: Permission denied
-- Subject: Process /opt/tomcat/bin/startup.sh could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- The process /opt/tomcat/bin/startup.sh could not be executed and failed.
-- 
-- The error number returned by this process is 13.
Aug 22 00:12:27 aimed-ubuntu-blr systemd[1]: tomcat.service: Control process exited, code=exited status=203
Aug 22 00:12:27 aimed-ubuntu-blr systemd[1]: Failed to start Apache Tomcat Web Application Container.
-- Subject: Unit tomcat.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit tomcat.service has failed.
-- 
-- The result is failed.
Aug 22 00:12:27 aimed-ubuntu-blr systemd[1]: tomcat.service: Unit entered failed state.
Aug 22 00:12:27 aimed-ubuntu-blr systemd[1]: tomcat.service: Failed with result 'exit-code'.

Im having a issue that when I restarted the Ubuntu 16.04 running Tomcat 8, it would not let me accessโ€ฆ

I saw that it was binding it to IPv6 so I disabled it a kernel level. Now it is listening to IPv4 but it still does not let me access.

๐Ÿ‘ Creative Commons
This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License.
  • Deploy on DigitalOcean

    Click below to sign up for DigitalOcean's virtual machines, Databases, and AIML products.

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and AI-native businesses

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOceanโ€™s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow โ€” whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

ยฉ 2026 DigitalOcean, LLC.Sitemap.
Dark mode is coming soon.