Tomcat 6 + Eclipse 3.5 on Ubuntu 9.10

November 11, 2009 · 3 Comments
Filed under: Eclipse, Featured, IDE Tools, Linux, Tomcat, Ubuntu 

There are 2 ways to install Tomcat on Ubuntu: automatically from repository and manually from Apache.

1.Install from repository (tomcat6-admin and tomcat6-webapps are optional)

sudo get-apt install tomcat6 tomcat6-admin tomcat6-webapps

then start/stop/restart tomcat with following command

/etc/init.d/tomcat5.5 start
/etc/init.d/tomcat5.5 stop
/etc/init.d/tomcat5.5 restart

The problem is that you cannot configure Eclipse to work with it because conf and lib are under different directories. So for development machines, you might want to install it manually. In case you have installed it from repository, you can remove it with

sudo apt-get –purge remove tomcat6 tomcat6-admin tomcat6-webapps

2.Install Manually
download tomcat from Apache

tar -zxvf apache-tomcat-x.x.xx.tar.gz
sudo mv apache-tomcat-x.x.xx /opt/
ln -s apache-tomcat-x.x.xx tomcat
sudoedit ~/.bashrc

add this line




export CATALINA_HOME=/opt/tomcat

start/stop tomcat with

$CATALINA_HOME/bin/startup.sh
$CATALINA_HOME/bin/shutdown.sh

To use tomcat manager, you have to configure users.

sudoedit /opt/tomcat/conf/tomcat-users.xml

add

<user name=”admin” password=”admin” roles=”manager,admin” />

right before </tomcat-users>

Integrate Tomcat into Eclipse
Window->Preferences->
Server->Runtime Environments->Add->
Apache Tomcat V6.0->Next->
Browse->/opt/apache-tomcat-x.x.xx->OK
Finish->OK