Setting up TomCat on uBuntu Dapper 6.06
A Definitive HOWTO - Newb friendly
Prerequisites
Useful links:
Install uBuntu 6.06
run easyubuntu and install any updates you need - install the sun java runtime
wget http://easyubuntu.freecontrib.org/files/easyubuntu-3.023.tar.gz
tar -zxf easyubuntu-3.023.tar.gz
cd easyubuntu
sudo python easyubuntu.in
Install the JAVA JDK, Apache and Tomcatsudo apt-get install sun-java5-jdk, apache2, tomcat
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.06
cd /usr/share/tomcat5/bin
sudo ./startup.sh
All should be fine and you will see where tomcat is installed.
the following are defined for the rest of the tutorial.
CATALINA_BASE: /usr/share/tomcat5
CATALINA_HOME: /usr/share/tomcat5CATALINA_TMPDIR: /usr/share/tomcat5/tempJAVA_HOME: /usr/lib/jvm/java-1.5.0-sun-1.5.0.06
open firefox
goto http://localhost:8180 pervey the goodness that is apache and tomcat
Tweak the Tomcat Users
sudo vi /usr/share/tomcat5/conf/tomcat-users.xml
Non vi users, substitute the word vi for gedit for the rest of the tutorial
You need to give the tomcat user permissions to use the admin area and change the default tomcat password.
Make the file look as follows:
<?xml version='1.0' encoding='utf-8'?><tomcat-users> <role rolename="tomcat"/> <role rolename="role1"/> <role rolename="manager" description=""/> <role rolename="admin"/> <user username="tomcat" password="yourpassword" fullName="" roles="admin,manager,tomcat"/> <user username="both" password="tomcat" roles="tomcat,role1"/> <user username="role1" password="tomcat" roles="role1"/></tomcat-users>save the file, restart tomcat
sudo /etc/init.d/tomcat5 restartConnecting to MS SQL
Useful links:
database JDBC jar files go in $CATALINA_HOME/common/lib. Looking here I could find no trace of the required .jar JDBC driver for MS SQL.
Go to
The JDBC Download Page or search for'
SQL Server 2000 Driver for JDBC Service Pack 2'Download the .tar file, setup instructions are there as well.
Use WinSCP (
http://winscp.net/eng/index.php ) to copy it to your java server if you did not download it from uBuntu.
You may need to do a
sudo apt-get install ssh (ssh won't be installed by default and it must be to connect to the machine with winscp)Follow the following instructions
Microsoft releases the script file as a korn shell script *nice one*
let's install ksh shall we
sudo apt-get install ksh1. Copy the mssqlserver.tar file to a temporary directory on your machine.
2. Change to the temporary directory and untar the contents of the file.
Enter: tar -xvf mssqlserver.tar
The contents of the tar file will appear in the directory.
3. Run the installation script.
Enter: sudo ./install.ksh
If you wish to exit the script at any time, press CTRL C.
4. You are asked if you want to view the license agreement.
Press ENTER to proceed.
5. After viewing the license agreement, press ENTER to accept
it or N to exit.
6. You are asked to specify an installation directory. Enter
the full path to the directory.
7. The script displays a message when the installation is complete.
The files were copied to /opt/msSQLjdbc
the required .jar files are in /opt/msSQLjdbc/lib
Now we could ensure the above directory is in the CLASSPATH variable .... or ... we could copy the files to $CATALINA_HOME/common/lib, let's do that rather
sudo cp /opt/msSQLjdbc/lib/* /usr/share/tomcat5/common/lib
goto http://localhost:8180
log in to the admin area
click on datasources in the left, in the right panel click create new datasource

Add the following items to the textboxes
JNDI NAME: myconnectionname
DATA SOURCE URL: jdbc:microsoft:sqlserver://yourserver:1433;databasename:dbname
JDBC DRIVE CLASS: com.microsoft.jdbc.sqlserver.SQLServerDriver
USER NAME: username
PASSWORD: passwd
all these are variable depending on your database