How to install Tomcat on Ubuntu

This tutorial shows you how to install Tomcat on Ubuntu, with help of the buith-in apt-get command.

1. apt-get install

1.1 Find an available Tomcat package to install


$ sudo apt-cache search tomcat
//...
tomcat7 - Servlet and JSP engine
tomcat7-admin - Servlet and JSP engine -- admin web applications
tomcat7-common - Servlet and JSP engine -- common files
tomcat7-docs - Servlet and JSP engine -- documentation
tomcat7-examples - Servlet and JSP engine -- example web applications

1.2 Install the following Tomcat packages :


$ sudo apt-get install tomcat7-admin
$ sudo apt-get install tomcat7

1.3 Done. Tomcat is installed and configured automatically.

2. Where is Tomcat installed?

2.1 Tomcat auto start script is created in /etc/init.d/ folder.


$ sudo /etc/init.d/tomcat7 start
$ sudo /etc/init.d/tomcat7 stop
$ sudo /etc/init.d/tomcat7 restart

2.2 Tomcat bin folder is created in /usr/share/tomcat7.


$ ls -lsa /usr/share/tomcat7/

 4 drwxr-xr-x   4 root root  4096 Mac  11 23:21 .
12 drwxr-xr-x 282 root root 12288 Mac  11 23:21 ..
 4 drwxr-xr-x   2 root root  4096 Mac  11 23:21 bin
 4 -rw-r--r--   1 root root    39 Jul  31  2013 defaults.md5sum
 4 -rw-r--r--   1 root root  2030 Jul  31  2013 defaults.template
 4 drwxr-xr-x   2 root root  4096 Mac  11 23:21 lib
 4 -rw-r--r--   1 root root    53 Jul  31  2013 logrotate.md5sum
 4 -rw-r--r--   1 root root   118 Jul  31  2013 logrotate.template

2.3 Tomcat conf and logs folders are created in /var/lib/tomcat7.


$ ls -lsa /var/lib/tomcat7/

4 drwxr-xr-x  6 root    root    4096 Mac  11 23:21 .
4 drwxr-xr-x 64 root    root    4096 Mac  11 23:21 ..
4 drwxr-xr-x  3 tomcat7 tomcat7 4096 Mac  11 23:21 common
0 lrwxrwxrwx  1 root    root      12 Mac   5 01:20 conf -> /etc/tomcat7
0 lrwxrwxrwx  1 root    root      17 Mac   5 01:20 logs -> ../../log/tomcat7
4 drwxr-xr-x  3 tomcat7 tomcat7 4096 Mac  11 23:21 server
4 drwxr-xr-x  3 tomcat7 tomcat7 4096 Mac  11 23:21 shared
4 drwxrwxr-x  3 tomcat7 tomcat7 4096 Mac  11 23:21 webapps
0 lrwxrwxrwx  1 root    root      19 Mac   5 01:20 work -> ../../cache/tomcat7

References

  1. Tomcat Setup
  2. Apache Tomcat

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
22 Comment threads
7 Thread replies
1 Followers
 
Most reacted comment
Hottest comment thread
23 Comment authors
sekharMunequita SchrammAnon NimoTugrul Asikgirls tutus Recent comment authors
newest oldest most voted
sekhar
Guest
sekhar

how to install eclipse oxygen in ubuntu

Munequita Schramm
Guest
Munequita Schramm

does is work on ubuntu 14.10? Coz it’s not working here.

Anon Nimo
Guest
Anon Nimo

I can’t believe it, every time I need something mkyong is there with a short, complete and easy to follow: answer.
Thanks again!

Tugrul Asik
Guest
Tugrul Asik

Simply and clear. Shortly, awesome ! Thanks a lot.

girls tutus
Guest
girls tutus

In this grand scheme of things you actually get an A for effort. For the moment I will subscribe to your issue.

Cem Ucar
Guest
Cem Ucar

This blog is awesome. It helped me to solve problems many times. Just wanted to thank you.

trackback
Slicehost- Tomcat installation on a tiny virtual server - Sky's Blog

[…] lesson for me was installing Tomcat 5.5 on Slicehost. I started by reading How to Install Tomcat on Ubuntu in the mkyong blog. Not bad at all. The essence is to first find out what version of Tomcat is […]

Vijay
Guest
Vijay

Great MK, always your site helps me.

Vibhav Joshi
Guest
Vibhav Joshi

I want to manually install apache server and configure it to run php with mysql … how do I go about that?

vinodh
Guest
vinodh

hi sir,
i want to install tomcat in linux manually without using apt-get,
i downloaded the source and done as you said but i am not getting the admin console screen.
when i am entering http://localhost:8080/ just it is showing “It works” page.from here i can not access my admin console.
how can i slove this?
please explain me.

Suraj
Guest
Suraj

i was new to tomcat in linux. i got this useful. thank you lot.

trackback
Move from Windows to Ubuntun – How to List « Artist of Code

[…] How to install Tomcat in Ubuntu. Post: http://www.mkyong.com/tomcat/how-to-install-tomcat-in-ubuntu/ […]

Thatikonda venkateswarlu
Guest
Thatikonda venkateswarlu

i wanted how to install tomcatserver in ubuntu 10.10, 32 bit

samdani
Guest
samdani

pls give me tutorial link that …how to install mysql 5.1 tar file in ubuntu ?

Diego Benna
Guest
Diego Benna

See this link:
http://diegobenna.blogspot.com/2011/01/install-tomcat-7-in-ubuntu-1010.html

for install tomcat7 on Linux (Ubuntu 10.10 tested)

Vlad Patryshev
Guest
Vlad Patryshev

Just wanted to thank you for concise and clear instructions that I follow.

Thank you!!!

-Vlad

Waxolunist
Guest
Waxolunist

I’ve found this link while looking for a installation manual. But it is not very actual any more.
Thus I blogged about installing tomcat 7 on ubuntu.
Have a look:
http://wiki.v-collaborate.com/display/BLOG/2010/12/08/Install+Apache+Tomcat+7+on+ubuntu+and+debian

immortalgeek
Guest
immortalgeek

Thanks for the instructions. I use manual install because I wanted to install an older version.

Roy
Guest
Roy

Just for your reference, you can install all these packages using a single command :)

Reference: http://www.linuxask.com/questions/install-multiple-software-at-the-same-time-using-apt-get

Leonor Brener
Guest
Leonor Brener

[..] A little unrelated, but I absolutely liked this blog post [..]

santosh
Guest
santosh

how can i access the tomcat port,web-app folder

trackback
Slicehost- Tomcat installation on a tiny virtual server - Sky’s Blog

[…] lesson for me was installing Tomcat 5.5 on Slicehost. I started by reading How to Install Tomcat on Ubuntu in the mkyong blog. Not bad at all. The essence is to first find out what version of Tomcat is […]