

Systemctl commands systemctl start tomcatĪt this point I generally go back to using the Ubuntu's service wrapper which abstracts the underlying implementation Reload services sudo systemctl daemon-reloadĮnable Tomcat service sudo systemctl enable tomcat Make Tomcat service executable chmod +x /etc/systemd/system/rvice

Unfortunately, with so little memory allocated you will probably run into several types of OutOfMemoryError issues Environment='CATALINA_OPTS=-Xms128m -Xmx256m -XX:MaxPermSize=128m =file:/dev/./urandom -server -XX:+UseParallelGC' Will need to reduce your memory settings a little more. If you are in a limited memory environment (like an EC2 t2.micro which only has 1GB of memory) you You may be able to get away with using 256m as the max heap size, but 512m is a good setting, You will likely encounter OutOfMemoryErrors with Tomcat's default memory settings. etc/systemd/system/rvice ĭescription=Apache Tomcat Web Application ContainerĮnvironment=CATALINA_PID=/opt/tomcat/temp/tomcat.pidĮnvironment='CATALINA_OPTS=-Xms1024m -Xmx1024m -XX:MaxPermSize=128m -server -XX:+UseParallelGC'Įnvironment='JAVA_OPTS=true =file:/dev/./urandom' Create service sudo vi /etc/systemd/system/rvice For example, /usr/lib/jvm/zulu-7-amd64/jre.

$ readlink -f /etc/alternatives/javaĬopy the path up to /bin/java. $ sudo chown -R tomcat:tomcat /opt/apache-tomcat-7.0.94Ĭopy and paste the output. $ sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat $ sudo tar xvzf apache-tomcat-7.0.94.tar.gzĬreate user, group and change permissions $ sudo groupadd tomcat
