104

Based here I'm trying to setup Tomcat Server, I have successfully installed it and tested it. Then I stopped it as recommended in the tutorial. I'm setting up "New Server Runtime Environment" as you can see under Tomcat Installation Directory is a windows directory, anyone knows the Ubuntu directory equivalent for this? Thanks.

Jorge Castro
  • 71,754
  • 1
    Apparently I don't have the rep here to answer, but for me on Ubuntu 18 it is in /opt/tomcat/apache-tomcat-8.5.50 – demongolem Apr 07 '20 at 14:59

10 Answers10

121

There are three important directories for Tomcat:

  • /etc/tomcat{X} for configuration

  • /usr/share/tomcat{X} for runtime, called CATALINA_HOME

  • /usr/share/tomcat{X}-root for webapps

The alternative path to Tomcat, called CATALINA_BASE, is /var/lib/tomcat{X}

The temp folder for Tomcat is /tmp/tomcat{X}-tomcat{X}-tmp

All the above paths work for Tomcat 6, 7, and 8. Replace {X} with the appropriate Tomcat major version number, e.g. /etc/tomcat8.

Ash
  • 3
62

After installing Tomcat with apt-get on Ubuntu 12.04, Tomcat creates and uses these directories:

/etc/tomcat6/

/etc/tomcat6/
├── Catalina
│   └── localhost
│       ├── ROOT.xml
│       └── solr.xml -> ../../../solr/solr-tomcat.xml
├── catalina.properties
├── context.xml
├── logging.properties
├── policy.d
│   ├── 01system.policy
│   ├── 02debian.policy
│   ├── 03catalina.policy
│   ├── 04webapps.policy
│   ├── 05solr.policy -> /etc/solr/tomcat.policy
│   └── 50local.policy
├── server.xml
├── tomcat-users.xml
└── web.xml

/usr/share/tomcat6

/usr/share/tomcat6
├── bin
│   ├── bootstrap.jar
│   ├── catalina.sh
│   ├── catalina-tasks.xml
│   ├── digest.sh
│   ├── setclasspath.sh
│   ├── shutdown.sh
│   ├── startup.sh
│   ├── tomcat-juli.jar -> ../../java/tomcat-juli.jar
│   ├── tool-wrapper.sh
│   └── version.sh
├── defaults.md5sum
├── defaults.template
└── lib
    ├── annotations-api.jar -> ../../java/annotations-api-6.0.35.jar
    ├── catalina-ant.jar -> ../../java/catalina-ant-6.0.35.jar
    ├── catalina-ha.jar -> ../../java/catalina-ha-6.0.35.jar
    ├── catalina.jar -> ../../java/catalina-6.0.35.jar
    ├── catalina-tribes.jar -> ../../java/catalina-tribes-6.0.35.jar
    ├── commons-dbcp.jar -> ../../java/commons-dbcp.jar
    ├── commons-pool.jar -> ../../java/commons-pool.jar
    ├── el-api.jar -> ../../java/el-api-2.1.jar
    ├── jasper-el.jar -> ../../java/jasper-el-6.0.35.jar
    ├── jasper.jar -> ../../java/jasper-6.0.35.jar
    ├── jasper-jdt.jar -> ../../java/ecj.jar
    ├── jsp-api.jar -> ../../java/jsp-api-2.1.jar
    ├── servlet-api.jar -> ../../java/servlet-api-2.5.jar
    ├── tomcat-coyote.jar -> ../../java/tomcat-coyote-6.0.35.jar
    ├── tomcat-i18n-es.jar -> ../../java/tomcat-i18n-es-6.0.35.jar
    ├── tomcat-i18n-fr.jar -> ../../java/tomcat-i18n-fr-6.0.35.jar
    └── tomcat-i18n-ja.jar -> ../../java/tomcat-i18n-ja-6.0.35.jar

/usr/share/tomcat6-root/

/usr/share/tomcat6-root/
└── default_root
    ├── index.html
    └── META-INF
        └── context.xml

/usr/share/doc/tomcat6

/usr/share/doc/tomcat6
├── changelog.Debian.gz -> ../libtomcat6-java/changelog.Debian.gz
├── copyright
└── README.Debian.gz -> ../tomcat6-common/README.Debian.gz

/var/cache/tomcat6

/var/cache/tomcat6
├── Catalina
│   └── localhost
│       ├── _
│       └── solr
│           └── org
│               └── apache
│                   └── jsp
│                       ├── admin
│                       │   ├── form_jsp.class
│                       │   ├── form_jsp.java
│                       │   ├── get_002dproperties_jsp.class
│                       │   ├── get_002dproperties_jsp.java
│                       │   ├── index_jsp.class
│                       │   ├── index_jsp.java
│                       │   ├── schema_jsp.class
│                       │   ├── schema_jsp.java
│                       │   ├── stats_jsp.class
│                       │   ├── stats_jsp.java
│                       │   ├── threaddump_jsp.class
│                       │   └── threaddump_jsp.java
│                       ├── index_jsp.class
│                       └── index_jsp.java
└── catalina.policy

/var/lib/tomcat6

/var/lib/tomcat6
├── common
│   └── classes
├── conf -> /etc/tomcat6
├── logs -> ../../log/tomcat6
├── server
│   └── classes
├── shared
│   └── classes
├── webapps
│   └── ROOT
│       ├── index.html
│       └── META-INF
│           └── context.xml
└── work -> ../../cache/tomcat6

/var/log/tomcat6

/var/log/tomcat6
├── catalina.2013-06-28.log
├── catalina.2013-06-30.log
├── catalina.out
├── catalina.out.1.gz
└── localhost.2013-06-28.log

/etc/default

/etc/default
├── tomcat7
st_pati
  • 731
  • 5
  • 3
11

If you install Tomcat 7 using apt:

sudo apt-get install tomcat7

Then the webapps are located in /var/lib/tomcat7

$ tree  /var/lib/tomcat7 -L 2
/var/lib/tomcat7
├── common
│   └── classes
├── conf -> /etc/tomcat7
├── logs -> ../../log/tomcat7
├── server
│   └── classes
├── shared
│   └── classes
├── webapps
│   └── ROOT
└── work -> ../../cache/tomcat7
0xF2
  • 3,154
ATOzTOA
  • 330
5

for tomcat 7, if you are working with Intellij IDE:

Tomcat Home: /usr/share/tomcat7

Tomcat base directory: /var/lib/tomcat7

Yar
  • 171
  • 1
    Thanks a lot for this. This is directory is what Intellji Ultimate Editon has been asking for last 3 couple of days. One problem though: I am getting "permission denied" statement when I run the programming. It says,

    "Error running 'Unnamed': Error copying configuration files from /var/lib/tomcat9/conf to /home/pranav/.IntelliJIdea2019.2/system/tomcat/Unnamed_Project101/conf: /var/lib/tomcat9/conf/server.xml (Permission denied) "

    –  Aug 02 '19 at 04:45
4

This is the default Tomcat home page, that can be found on the local file system at:

/var/lib/tomcat7/webapps/ROOT/index.html
v2r
  • 9,547
ashish
  • 41
  • 1
4

I installed tomcat7 via apt-get, but its directory was not unlike tomcat6.

It was located in /usr/share/tomcat7

Niko
  • 1,095
  • 1
  • 9
  • 15
3

I have followed the Vogella tutorial to set up the Tomcat server, and I ran into the same issue. If you had installed tomcat7 using the instructions mentioned in the tutorial, just mention the below path in the Tomcat installation directory field, when setting up the server runtime environment in eclipse

/usr/share/tomcat7

When I proceeded with the above path, I faced another issue (Could not load the Tomcat server configuration), for which I executed the below commands in terminal and restarted Eclipse. (Source)

cd /usr/share/tomcat7
sudo ln -s /var/lib/tomcat7/conf conf
sudo ln -s /etc/tomcat7/policy.d/03catalina.policy conf/catalina.policy
sudo ln -s /var/log/tomcat7 logs
sudo chmod -R 777 /usr/share/tomcat7/conf
dennyac
  • 217
2

Assuming your are installing Tomcat 6, it will be at:

/usr/share/tomcat6

Boj
  • 208
1

Simple, use linux find tool, (you might need to find as sudo user)

sudo find / -name tomcat7
/etc/logrotate.d/tomcat7
/etc/default/tomcat7
/etc/tomcat7
/etc/init.d/tomcat7
/etc/cron.daily/tomcat7
/usr/share/doc-base/tomcat7
/usr/share/tomcat7
/usr/share/doc/tomcat7
/var/lib/doc-base/documents/tomcat7
/var/lib/tomcat7
/var/cache/tomcat7
/var/log/tomcat7

I always forget where's the webapps is while deploying the war, this is my command,

sudo find / -name webapps
/var/lib/tomcat7/webapps
/home/prayagupd/.mozilla/firefox/kmsa14n9.default/webapps

Apparently, it not the second one.

prayagupa
  • 387
  • 2
  • 4
  • 16
0

These are some of the key tomcat directories:

  • /bin - Startup, shutdown, and other scripts. The *.sh files (for Unix systems) are functional duplicates of the *.bat files (for Windows systems). Since the Win32 command-line lacks certain functionality, there are some additional files in here.
  • /conf - Configuration files and related DTDs. The most important file in here is server.xml. It is the main configuration file for the container.
  • /logs - Log files are here by default.
  • /webapps - This is where your webapps go.

You may check where there are by the following commands:

dpkg -L tomcat7
dpkg -L tomcat7-common

Change tomcat7 to your appropriate package name. By default for Tomcat7 it's usually /usr/share/tomcat7.

kenorb
  • 10,347