You are on page 1of 19

9/2/2016 How 

To Install Apache Tomcat 8 on CentOS 7 | DigitalOcean

Communit  Menu
   

: Mitchell Anicas  uscrie   hare  Contents 

How To Install Apache Tomcat 8 on CentO 7

5 Posted Jun 19, 2015   95.9k   Java   Deploment   CentO

Introduction

Apache Tomcat is a we server and servlet container that is used to serve Java applications. Tomcat

is an open source implementation of the Java ervlet and Javaerver Pages technologies, released

 the Apache oftware Foundation. This tutorial covers the asic installation and some

configuration of the latest release of Tomcat 8 on our CentO 7 server.

Prerequisites

efore ou egin with this guide, ou should have a separate, non-root user account set up on our

server. You can learn how to do this  completing steps 1-3 in the initial server setup for CentO 7.

We will e using the  demo  user created here for the rest of this tutorial.

Install Java

Tomcat requires that Java is installed on the server, so an Java we application code can e

executed. Let's satisf that requirement  installing OpenJDK 7 with um.

To install OpenJDK 7 JDK using um, run this command:

$ sudo yum install java‐1.7.0‐openjdk‐devel

Answer  y  at the prompt to continue installing OpenJDK 7.

Note that a shortcut to the JAVA_HOM director, which we will need to configure Tomcat later, can

e found at  /usr/lib/jvm/jre .

https://www.digitalocean.com/community/tutorials/how­to­install­apache­tomcat­8­on­centos­7 1/19
9/2/2016 How To Install Apache Tomcat 8 on CentOS 7 | DigitalOcean

Now that Java is installed, let's create a  tomcat  user, which will e used to run the Tomcat service.

Create Tomcat User

For securit purposes, Tomcat should e run as an unprivileged user (i.e. not root). We will create a

new user and group that will run the Tomcat service.

First, create a new  tomcat  group:

$ sudo groupadd tomcat

Then create a new  tomcat  user. We'll make this user a memer of the  tomcat  group, with a home


director of  /opt/tomcat  (where we will install Tomcat), and with a shell of  /bin/false  (so nood
can log into the account):

$ sudo useradd ‐M ‐s /bin/nologin ‐g tomcat ‐d /opt/tomcat tomcat

Now that our  tomcat  user is set up, let's download and install Tomcat.

Install Tomcat

The easiest wa to install Tomcat 8 at this time is to download the latest inar release then

configure it manuall.

Download Tomcat inar

Find the latest version of Tomcat 8 at the Tomcat 8 Downloads page. At the time of writing, the

latest version is 8.0.23. Under the inar Distriutions section, then under the Core list, cop the

link to the "tar.gz".

Let's download the latest inar distriution to our home director.

First, change to our home director:

$ cd ~

https://www.digitalocean.com/community/tutorials/how­to­install­apache­tomcat­8­on­centos­7 2/19
9/2/2016 How To Install Apache Tomcat 8 on CentOS 7 | DigitalOcean

Then use  wget  and paste in the link to download the Tomcat 8 archive, like this (our mirror link will


proal differ from the example):

$ wget http://mirror.sdunix.com/apache/tomcat/tomcat‐8/v8.0.23/bin/apache‐tomcat‐8.0.23.tar.gz

We're going to install Tomcat to the  /opt/tomcat  director. Create the director, then extract the


the archive to it with these commands:

$ sudo mkdir /opt/tomcat
$ sudo tar xvf apache‐tomcat‐8*tar.gz ‐C /opt/tomcat ‐‐strip‐components=1

Now we're read to set up the proper user permissions.

Update Permissions

The  tomcat  user that we set up needs to have the proper access to the Tomcat installation. We'll


set that up now.

Change to the Tomcat installation path:

$ cd /opt/tomcat

Then give the  tomcat  user write access to the  conf  director, and read access to the files in that


director:

$ sudo chgrp ‐R tomcat conf
$ sudo chmod g+rwx conf
$ sudo chmod g+r conf/*

Then make the  tomcat  user the owner of the  webapps ,  work ,  temp , and  logs  directories:

$ sudo chown ‐R tomcat webapps/ work/ temp/ logs/

https://www.digitalocean.com/community/tutorials/how­to­install­apache­tomcat­8­on­centos­7 3/19
9/2/2016 How To Install Apache Tomcat 8 on CentOS 7 | DigitalOcean

Now that the proper permissions are set up, let's set up a stemd unit file.

Install stemd Unit File

ecause we want to e ale to run Tomcat as a service, we will set up a Tomcat stemd unit file .

Create and open the unit file  running this command:

$ sudo vi /etc/systemd/system/tomcat.service

Paste in the following script. You ma also want to modif the memor allocation settings that are

specified in  CATALINA_OPTS :

/etc/sstemd/sstem/tomcat.service

# Systemd unit file for tomcat
[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target

[Service]
Type=forking

Environment=JAVA_HOME=/usr/lib/jvm/jre
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment='CATALINA_OPTS=‐Xms512M ‐Xmx1024M ‐server ‐XX:+UseParallelGC'
Environment='JAVA_OPTS=‐Djava.awt.headless=true ‐Djava.security.egd=file:/dev/./urandom'

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/bin/kill ‐15 $MAINPID

User=tomcat
Group=tomcat

[Install]
WantedBy=multi‐user.target

https://www.digitalocean.com/community/tutorials/how­to­install­apache­tomcat­8­on­centos­7 4/19
9/2/2016 How To Install Apache Tomcat 8 on CentOS 7 | DigitalOcean

ave and exit. This script tells the server to run the Tomcat service as the  tomcat  user, with the


settings specified.

Now reload stemd to load the Tomcat unit file:

$ sudo systemctl daemon‐reload

Now ou can start the Tomcat service with this  systemctl  command:

$ sudo systemctl start tomcat

If ou want to enale the Tomcat service, so it starts on server oot, run this command:

$ sudo systemctl enable tomcat

Tomcat is not completel set up et, ut ou can access the default splash page  going to our

domain or IP address followed   :8080  in a we rowser:

Open in web browser:
http://server_IP_address:8080

You will see the default Tomcat splash page, in addition to other information. Now we will go deeper

into the installation of Tomcat.

Configure Tomcat We Management Interface

In order to use the manager weapp that comes with Tomcat, we must add a login to our Tomcat

server. We will do this  editing the  tomcat‐users.xml  file:

$ sudo vi /opt/tomcat/conf/tomcat‐users.xml

This file is filled with comments which descrie how to configure the file. You ma want to delete all

the comments etween the following two lines, or ou ma leave them if ou want to reference the

https://www.digitalocean.com/community/tutorials/how­to­install­apache­tomcat­8­on­centos­7 5/19
9/2/2016 How To Install Apache Tomcat 8 on CentOS 7 | DigitalOcean

examples:

tomcat-users.xml excerpt

<tomcat‐users>
...
</tomcat‐users>

You will want to add a user who can access the  manager‐gui  and  admin‐gui  (weapps that come


with Tomcat). You can do so  defining a user similar to the example elow. e sure to change the

username and password to something secure:

tomcat-users.xml — Admin User

<tomcat‐users>
    <user username="admin" password="password" roles="manager‐gui,admin‐gui"/>
</tomcat‐users>

ave and quit the tomcat-users.xml file. To put our changes into effect, restart the Tomcat service:

$ sudo systemctl restart tomcat

Access the We Interface

Now that Tomcat is up and running, let's access the we management interface in a we rowser.

You can do this  accessing the pulic IP address of the server, on port 8080:

Open in web browser:
http://server_IP_address:8080

ign up for our newsletter. ×
Get the latest tutorials on sAdmin and open source topics.
You will see something like the following image:

nter our email address   ign Up

CROLL TO TOP

https://www.digitalocean.com/community/tutorials/how­to­install­apache­tomcat­8­on­centos­7 6/19
9/2/2016 How To Install Apache Tomcat 8 on CentOS 7 | DigitalOcean

As ou can see, there are links to the admin weapps that we configured an admin user for.

Let's take a look at the Manager App, accessile via the link or

http://server_IP_address:8080/manager/html :

ign up for our newsletter.
The We Application Manager is used to manage our Java applications. You can tart, top, ×
Reload, Deplo, and Undeplo here. Y ou can also run some diagnostics on our apps (i.e. find
Get the latest tutorials on sAdmin and open source topics.

memor leaks). Lastl, information aout our server is availale at the ver ottom of this page.
nter our email address   ign Up

Now let's take a look at the Host Manager, accessile via the link or

http://server_IP_address:8080/host‐manager/html/ :
CROLL TO TOP

https://www.digitalocean.com/community/tutorials/how­to­install­apache­tomcat­8­on­centos­7 7/19
9/2/2016 How To Install Apache Tomcat 8 on CentOS 7 | DigitalOcean

From the Virtual Host Manager page, ou can add virtual hosts to serve our applications from.

Conclusion

Your installation of Tomcat is complete! Your are now free to deplo our own Java we

applications!

: Mitchell Anicas
Upvote (5)  uscrie   hare

pin up an D cloud server in under a minute.

imple setup. Full root access. traightforward pricing.

ign up for our newsletter. ×
DPLOY RVR

Get the latest tutorials on sAdmin and open source topics.

nter our email address   ign Up

CROLL TO TOP

https://www.digitalocean.com/community/tutorials/how­to­install­apache­tomcat­8­on­centos­7 8/19
9/2/2016 How To Install Apache Tomcat 8 on CentOS 7 | DigitalOcean

Related Tutorials

How To ncrpt Tomcat 8 Connections with Apache or Nginx on Uuntu 16.04

How To Install Apache Tomcat 8 on Uuntu 16.04

How To Install Java with Apt-Get on Uuntu 16.04

How To Optimize Your Tomcat Installation on Uuntu 14.04

How To Install Apache Kafka on Uuntu 14.04

20 Comments

Leave a comment...

Log In to Comment

saronic  August 21, 2015

Hi,thanks our log. I have followed our instruction exactl and ip:8080 works. ut, I changed the
0

tomcat's listen port from 8080 to 80 in the tomcat home director/conf/server.xml, after :sudo

sstemctl restart tomcat.service. I can't access ip:80. and find that tomcat does not listen at port 80

 :netstat an | grep 80
ign up for our newsletter. ×
ut I use the script:tomcat_home/in/start.sh , ip:80 works again.

Get the latest tutorials on sAdmin and open source topics.
Please tell me where I did wrong.

THANK.
nter our email address   ign Up

manicas  MOD   August 21, 2015


CROLL TO TOP

https://www.digitalocean.com/community/tutorials/how­to­install­apache­tomcat­8­on­centos­7 9/19
9/2/2016 How To Install Apache Tomcat 8 on CentOS 7 | DigitalOcean

0 Do ou know if the user ou are running Tomcat as has permission to ind to ports < 1024?

saronic  August 23, 2015

0
[deleted]

saronic  August 23, 2015

thanks ou repl.
0

M /etc/sstemd/sstem/tomcat.service:

# Systemd unit file for tomcat
[Unit]
... ....
[Service]
User=tomcat
Group=tomcat

so I guess the user who are running Tomcat is 'tomcat'. I donot know if 'tomcat' has the permission to

ind to port < 1024?

I just add the user : tomcat to sstem with command:

$ sudo useradd ‐M ‐s /bin/nologin ‐g tomcat ‐d /opt/tomcat tomcat

I did nothing else to tell the centos 7 if the user :tomcat should has the permission to ind port <

1024.

DarkLogix  Octoer 10, 2015

I followed all the instructions with just a few tweaks
0

I changed the group name from tomcat to tomcatGP ( just to make it clear which was the group and

which was the user.)

ign up for our newsletter. ×
and I installed jave 8u60 via "um - install java-1.8.0-openjdk.x86_64"

Get the latest tutorials on sAdmin and open source topics.

I have the page up and running on 8080 ut when I tested deploing a war file via the manager we

nter our email address
app I got a permission error.   ign Up

this is just one part in getting m gauc server going, I want to get tomcat 8 w/ java 8, on centO7 with

the ARP listener using m 16,384it wildcard cert working and then work on the other parts of getting
CROLL TO TOP
guac running.

https://www.digitalocean.com/community/tutorials/how­to­install­apache­tomcat­8­on­centos­7 10/19
9/2/2016 How To Install Apache Tomcat 8 on CentOS 7 | DigitalOcean

DarkLogix  Octoer 11, 2015

Also can ou add info for installing APR support?
0

since I (and most people) would want to have the higher performance/more secure APR listener

for L I think it would e reasonale.

dauszus  Novemer 13, 2015

Got stuck tring to deplo a war. Had to make the tomcat user also own the weapps folder in order
0

to get this going.

curtisdecompile  Novemer 25, 2015

This was excellent help for me.
1

I have a suggestion and an issue.

To search for what Java versions are availale, use:

$sudo um search java | grep openjdk | more

One issue: I could not access the default Tomcat wesite on port 8080.

This is what I did:

Open the firewall:

$ sudo firewall-cmd --zone=pulic --add-port=8080/tcp --permanent

$ sudo firewall-cmd --reload

The first command uses --permanent. You are defining this port to e open after a reoot or reload.

The second command reload the firewall. You can check on the status of the ports  using:

$ sudo firewall-cmd --zone=pulic --list-ports

On m sstem, I get:

80/tcp 8080/tcp

nvironment: Tomcat 8.0.28, Java 1.8.0.

ign up for our newsletter. ×
 

Get the latest tutorials on sAdmin and open source topics.
tuananh  Decemer 17, 2015

nter our email address   ign Up
For someone when start tomcat 8 on Oracle JDK 8 and tomcat 8 hangout at "Deploing we
0

application director /opt/tomcat/weapps/ROOT"

You should edit file /usr/java/jdk1.8.0_66/jre/li/securit/java.securit and change line

securerandom.source=file:/dev/random
CROLL TO TOP

https://www.digitalocean.com/community/tutorials/how­to­install­apache­tomcat­8­on­centos­7 11/19
9/2/2016 How To Install Apache Tomcat 8 on CentOS 7 | DigitalOcean

 

securerandom.source=file:/dev/./urandom

ranjeet  March 27, 2016

I have installed ut not ale to login. I tried ever thing.
0

ranjeet  March 27, 2016

Getting error
0

28-Mar-2016 01:01:40.238 VR [main] org.apache.catalina.realm.CominedRealm.startInternal

Failed to start "org.apache.catalina.realm.UserDataaseRealm" realm

org.apache.catalina.Lifecclexception: Failed to start component [Realm[UserDataaseRealm]]

at org.apache.catalina.util.Lifecclease.start(Lifecclease.java:153)

at org.apache.catalina.realm.CominedRealm.startInternal(CominedRealm.java:250)

at org.apache.catalina.realm.LockOutRealm.startInternal(LockOutRealm.java:120)

at org.apache.catalina.util.Lifecclease.start(Lifecclease.java:147)

at org.apache.catalina.core.Containerase.startInternal(Containerase.java:904)

at org.apache.catalina.core.tandardngine.startInternal(tandardngine.java:262)

at org.apache.catalina.util.Lifecclease.start(Lifecclease.java:147)

at org.apache.catalina.core.tandardervice.startInternal(tandardervice.java:441)

at org.apache.catalina.util.Lifecclease.start(Lifecclease.java:147)

at org.apache.catalina.core.tandarderver.startInternal(tandarderver.java:787)

at org.apache.catalina.util.Lifecclease.start(Lifecclease.java:147)

at org.apache.catalina.startup.Catalina.start(Catalina.java:629)

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.ootstrap.start(ootstrap.java:351)

at org.apache.catalina.startup.ootstrap.main(ootstrap.java:485)

Caused : org.apache.catalina.Lifecclexception: No UserDataase component found under ke

UserDataase

at org.apache.catalina.realm.UserDataaseRealm.startInternal(UserDataaseRealm.java:241)

at org.apache.catalina.util.Lifecclease.start(Lifecclease.java:147)

ign up for our newsletter. ×
while m server.xml file

Get the latest tutorials on sAdmin and open source topics.

<?xml version='1.0' encoding='utf-8'?>

nter our email address
<!--   ign Up

Licensed to the Apache oftware Foundation (AF) under one or more

contriutor license agreements. ee the NOTIC file distriuted with

this work for additional information regarding copright ownership.
CROLL TO TOP

The AF licenses this file to You under the Apache License, Version 2.0

https://www.digitalocean.com/community/tutorials/how­to­install­apache­tomcat­8­on­centos­7 12/19
9/2/2016 How To Install Apache Tomcat 8 on CentOS 7 | DigitalOcean

(the "License"); ou ma not use this file except in compliance with

the License. You ma otain a cop of the License at

  http://www.apache.org/licenses/LICENSE‐2.0

Unless required  applicale law or agreed to in writing, software

distriuted under the License is distriuted on an "A I" AI,

WITHOUT WARRANTI OR CONDITION OF ANY KIND, either express or implied.

ee the License for the specific language governing permissions and

limitations under the License.

-->

<!-- Note: A "erver" is not itself a "Container", so ou ma not

define sucomponents such as "Valves" at this level.

Documentation at /docs/config/server.html

-->

<erver port="8005" shutdown="HUTDOWN">

<Listener className="org.apache.catalina.startup.VersionLoggerListener" />

<!-- ecurit listener. Documentation at /docs/config/listeners.html

<Listener className="org.apache.catalina.securit.ecuritListener" />

-->

<!--APR lirar loader. Documentation at /docs/apr.html -->

<Listener className="org.apache.catalina.core.AprLifeccleListener" Lngine="on" />

<!--Initialize Jasper prior to weapps are loaded. Documentation at /docs/jasper-howto.html -->

<Listener className="org.apache.catalina.core.JasperListener" />

<!-- Prevent memor leaks due to use of particular java/javax APIs-->

<Listener className="org.apache.catalina.core.JreMemorLeakPreventionListener" />

<Listener className="org.apache.catalina.means.GloalResourcesLifeccleListener" />

<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

<!-- Gloal JNDI resources

Documentation at /docs/jndi-resources-howto.html

-->

<GloalNamingResources>

<!-- ditale user dataase that can also e used 

UserDataaseRealm to authenticate users

-->

<Resource name="UserDataase" auth="Container"

ign up for our newsletter.
tpe="org.apache.catalina.UserDataase" ×
description="User dataase that can e updated and saved"
Get the latest tutorials on sAdmin and open source topics.
factor="org.apache.catalina.users.MemorUserDataaseFactor"

pathname="conf/tomcat-users.xml" />
nter our email address   ign Up

</GloalNamingResources>

<!-- A "ervice" is a collection of one or more "Connectors" that share

a single "Container" Note: A "ervice" is not itself a "Container", CROLL TO TOP

https://www.digitalocean.com/community/tutorials/how­to­install­apache­tomcat­8­on­centos­7 13/19
9/2/2016 How To Install Apache Tomcat 8 on CentOS 7 | DigitalOcean

so ou ma not define sucomponents such as "Valves" at this level.

Documentation at /docs/config/service.html

-->

<ervice name="Catalina">

<!‐‐The connectors can use a shared executor, you can define one or more named thread pools‐
<!‐‐
<Executor name="tomcatThreadPool" namePrefix="catalina‐exec‐"
    maxThreads="150" minSpareThreads="4"/>
‐‐>

<!‐‐ A "Connector" represents an endpoint by which requests are received
     and responses are returned. Documentation at :
     Java HTTP Connector: /docs/config/http.html (blocking & non‐blocking)
     Java AJP  Connector: /docs/config/ajp.html
     APR (HTTP/AJP) Connector: /docs/apr.html
     Define a non‐SSL HTTP/1.1 Connector on port 8080
‐‐>
<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" />
<!‐‐ A "Connector" using the shared thread pool‐‐>
<!‐‐
<Connector executor="tomcatThreadPool"
           port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" />
‐‐>
<!‐‐ Define a SSL HTTP/1.1 Connector on port 8443
     This connector uses the BIO implementation that requires the JSSE
     style configuration. When using the APR/native implementation, the
     OpenSSL style configuration is required as described in the APR/native
     documentation ‐‐>
<!‐‐
<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
           maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
ign up for our newsletter. ×
           clientAuth="false" sslProtocol="TLS" />
Get the latest tutorials on sAdmin and open source topics.
‐‐>
nter our email address   ign Up

<!‐‐ Define an AJP 1.3 Connector on port 8009 ‐‐>
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

CROLL TO TOP

https://www.digitalocean.com/community/tutorials/how­to­install­apache­tomcat­8­on­centos­7 14/19
9/2/2016 How To Install Apache Tomcat 8 on CentOS 7 | DigitalOcean

<!‐‐ An Engine represents the entry point (within Catalina) that processes
     every request.  The Engine implementation for Tomcat stand alone
     analyzes the HTTP headers included with the request, and passes them
     on to the appropriate Host (virtual host).
     Documentation at /docs/config/engine.html ‐‐>

<!‐‐ You should set jvmRoute to support load‐balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
‐‐>
<Engine name="Catalina" defaultHost="localhost">

  <!‐‐For clustering, please take a look at documentation at:
      /docs/cluster‐howto.html  (simple how to)
      /docs/config/cluster.html (reference documentation) ‐‐>
  <!‐‐
  <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
  ‐‐>

  <!‐‐ Use the LockOutRealm to prevent attempts to guess user passwords
       via a brute‐force attack ‐‐>
  <Realm className="org.apache.catalina.realm.LockOutRealm">
    <!‐‐ This Realm uses the UserDatabase configured in the global JNDI
         resources under the key "UserDatabase".  Any edits
         that are performed against this UserDatabase are immediately
         available for use by the Realm.  ‐‐>
    <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
           resourceName="UserDatabase"/>
  </Realm>

  <Host name="localhost"  appBase="webapps"
        unpackWARs="true" autoDeploy="true">

    <!‐‐ SingleSignOn valve, share authentication between web applications
         Documentation at: /docs/config/valve.html ‐‐>
    <!‐‐
    <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
    ‐‐>
ign up for our newsletter. ×
Get the latest tutorials on sAdmin and open source topics.
    <!‐‐ Access log processes all example.
         Documentation at: /docs/config/valve.html
nter our email address   ign Up
         Note: The pattern used is equivalent to using pattern="common" ‐‐>
    <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
           prefix="localhost_access_log." suffix=".txt"
           pattern="%h %l %u %t &quot;%r&quot; %s %b" /> CROLL TO TOP

https://www.digitalocean.com/community/tutorials/how­to­install­apache­tomcat­8­on­centos­7 15/19
9/2/2016 How To Install Apache Tomcat 8 on CentOS 7 | DigitalOcean

  </Host>
</Engine>

</ervice>

</erver>

pixzon  March 30, 2016

Hello, i cant start Tomcat.
0

rrorcode

# sudo systemctl start tomcat
Job for tomcat.service failed because the control process exited with error code. See "syste

I use CentO 14.

Where can help me? :-)

uncleoni  Jul 30, 2016

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

krisclarkdev  April 25, 2016

In case anone is having a hard time getting this to start:
0

Tomcat 7+ relies heavil on entrop. I couldn't get Tomcat 7 or 8 to start at all, it kept hanging on

deploing the weapps. This was ecause it was waiting on increased entrop. To solve this I

enaled epel then:

ign up for our newsletter.
um install haveged ×
sstemctl start haveged
Get the latest tutorials on sAdmin and open source topics.
sstemctl enale haveged

nter our email address   ign Up

uano  Ma 11, 2016

CROLL TO TOP
it's ver good for me
0

https://www.digitalocean.com/community/tutorials/how­to­install­apache­tomcat­8­on­centos­7 16/19
9/2/2016 How To Install Apache Tomcat 8 on CentOS 7 | DigitalOcean

paulhr  Ma 13, 2016

Question 1) Wh the "kill -15" and not "shutdown.sh" in the "/etc/sstemd/sstem/tomcat.service" 
0

file?

Question 2) Where is MAINPID defined? It is used in "/etc/sstemd/sstem/tomcat.service" 

file, ut not defined there?

meshter  Ma 16, 2016

First of all, let me sa that this is was a great starting point for what I needed (not so man good
0

guides out there on this topic and Apache doesn't invest too much to deliver template scripts to

achieve this).

Regarding question 1, I had the same feeling - I used the shutdown script since it presumal is a

cleaner wa to shutdown tomcat. This is the line:

ExecStop=/bin/kill ‐15 $MAINPID

Also, this guide doesn't cover the installation of the apache tomcat native lirar. One should

consider that as well (or at least mention aout it).

As a last remark, a good practice that should e mentioned is the separation etween

CATALINAHOM and CATALINAA (this allows to deplo multiple tomcat services reusing the

same inaries and keeping them isolated).

paulhr  Ma 16, 2016

I am forced to use xectop=/in/kill -15 $MAINPID. For reason I could not discover, the use of
0

the shutdown.sh script fails. The errors give no details. I was hoping to learn wh  asking

the question.

While I do agree there is not much documentation on the topic I fail to understand how our

post answered the questions.

ign up for our newsletter. ×
 

Get the latest tutorials on sAdmin and open source topics.
dovuvnd  June 1, 2016

nter our email address
Hi ou. I have installed tomcat follow ou. It work.   ign Up
0

I have a prolem aout " Too man open files". I have configure in "/etc/securit/limits.conf " with 

``` * soft nofile 102400

CROLL TO TOP

https://www.digitalocean.com/community/tutorials/how­to­install­apache­tomcat­8­on­centos­7 17/19
9/2/2016 How To Install Apache Tomcat 8 on CentOS 7 | DigitalOcean

hard nofile 102400 tomcat soft nofile 102400 tomcat hard nofile 102400``. ut max open

file of m tomcat service onl 4096. Please help me. Thank ou.

egemotoff  Jul 10, 2016

some add, ou must set permission for director /in too, efore i do this im have error "Failed at step
0

XC spawning /usr/share/tomcat8/in/startup.sh: Permission denied"

sudo chown ‐R tomcat webapps/ work/ temp/ logs/ bin/

vahid4m  August 15, 2016

In m case, it was necessar to change owner and group for everthing in /opt/tomcat .
0

This work is licensed under a Creative

Commons Attriution-NonCommercial-

hareAlike 4.0 International License.

ign up for our newsletter.  ×
Get the latest tutorials on sAdmin and open source topics.
Copright © 2016 DigitalOcean™ Inc.

nter our email address   ign Up
Communit  Tutorials  Questions  Projects  Tags  Newsletter  R   

Distros & One-Click Apps  Terms, Privac, & Copright  ecurit  Report a ug  Get Paid to Write

CROLL TO TOP

https://www.digitalocean.com/community/tutorials/how­to­install­apache­tomcat­8­on­centos­7 18/19
9/2/2016 How To Install Apache Tomcat 8 on CentOS 7 | DigitalOcean

ign up for our newsletter. ×
Get the latest tutorials on sAdmin and open source topics.

nter our email address   ign Up

CROLL TO TOP

https://www.digitalocean.com/community/tutorials/how­to­install­apache­tomcat­8­on­centos­7 19/19

You might also like