Manish's Tech Blog

Life is about Freedom and Sharing

Archive for July 21st, 2007

Installing and configuring Tomcat on Ubuntu

with 7 comments

This documentation owes its credits to the Ubuntu Community (Docs) and the book: Java-The Complete Reference by Herbert Schieldt where I learnt the basics of Java and Servlets. Let’s begin.

Before starting you need the Java Development Kit (JDK) and not Java Runtime Environment (JRE). Download it from http://java.sun.com as a .bin file and install it on your system or use the command:

sudo apt-get install sun-java5-jdk

Then set the Java Runtime variable

$ export JAVA_HOME=”Your java path”
$ export PATH=$PATH:$JAVA_HOME /bin

e.g. on Dapper

$ export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.06

Now use the following command to install Tomcat

$ sudo aptitude install tomcat5 tomcat5-admin tomcat5-webapps

Now its Done….

To Start, Stop and Restart the server

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


You can access the root directory via port 8180 and the server listens to the address 127.0.0.1 So type 127.0.0.1:8180 in your web browser to access the server.

A word of precaution: It’s better to avoid running Tomcat as root.
There are many other setting within Tomcat, I think the user should better try them out themselves. Some are:
1) Making Tomcat to run on port 80.
2) Turning off Directory Listings like Index Manager.
3) Check out the Tomcat configuration file and try out something of your own. Only precaution required is that you should not be logged in as root.

Written by Manish

July 21, 2007 at 8:30 PM

Enabling root login in ubuntu

with 16 comments

Many of you must have noticed that root login in ubuntu is disabled in default. Even su doesnt work. The ubuntu documentation says that “ubuntu is shipped with root account is locked“. Actually its a good move. The newcomers to ubuntu do not want to get frightened hearing the name ‘root‘. If you have moved passed the n00b stage you might want to unlock it.
Firstly you should set the root password. Login to ubuntu with the user which you created during installation. Go to System> Administration> Users and Groups. Select root. Click on Properties. Set the root password.
Secondly enable the root login. Click on System> Administration> Login Window. Click on Security tab. Check “Allow local administrator login“. Click on OK.
Everything is done. Now logout and log in with your root account.

A Word of CAUTION: Use your root account only when absolutely necessary. Never user root account for daily works. For regular work use the account created at installation time.
Reason: Root is the superuser. It has got all the unrestricted privileges to perform any tasks. Its like “I can do anything“.
While running as normal user you would be prompted for your password when you try to make a major change to system settings. Thus you would be alerted that your step is making some changes if you are ignorant of the step you are taking.
A virus is a program or script that intends to harm your system by changing the settings or configuration. At that stage you would be prompted for password, thus you can get warned.

Written by Manish

July 21, 2007 at 7:47 PM

Posted in Linux, Open Source, Ubuntu