Linux + Java2 + Tomcat + MySQL
1. Suppose all the software were downloaded at /home/dchan/mysql.
2. You should have login as root and make sure the software's owner and
group are root. Some software should be executive files.
Installation of Java compiler - JDK1.4, j2sdk-1_4_0-linux-rpm.bin
1. > cd /usr/local
2. > /home/dchan/mysql/j2sdk-1_4_0-linux-rpm.bin (if it does not run,
change it to executive file by chmod +x /home/dchan/mysql/j2sdk*.rpm.bin)
3. > rpm -iv --force j2sdk*.rpm
4. > cp /home/dchan/mysql/servlet.jar /usr/java/jdk1.4/lib
5. Set JAVA_HOME
export JAVA_HOME=/usr/java/jdk1.4
6. Set Java PATH
PATH=$PATH:/usr/java/jdk1.4/bin
7. Set CLASSPATH later.
Installation of JDBC for MySQL - mm.mysql*
1. Download the latest version of mm JDBC at http://www.mysql.com/
2. Copy the binary jar file to a directory,
> cd /usr/local
> jar xvf /home/dchan/mysql/mm.mysql*src.jar
> cp /home/dchan/mysql/mm.*bin.jar /usr/local/mm.mysql*
3. Set the path to CLASSPATH at tomcat.sh file later.
Installation of MySQL - mysql-3.23.31-pc-linux-gun-i686
1. > cd /usr/local
2. > tar zxvf /home/dchan/mysql/mysql*tar.gz
3. > cd mysql*
4. > ./configure
5. ./bin/mysqladmin create oscar or ./bin/mysql -u root
mysql> create database oscar;
mysql> quit
6. ./bin/mysql -u root -p oscar < /home/dchan/mysql/createoscar.sql
7. ./bin/mysql -u root -p oscar < /home/dchan/mysql/adddataoscar.sql
8. > ./bin/mysqladmin -u root password oscar //setup an admin password
for the db server
9. > ./bin/mysql -u root -poscar oscar
10. run the following script will help you more:
shell: groupadd mysql
shell: useradd -g mysql mysql
shell: cd /usr/local
shell: gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
shell: ln -s full-path-to-mysql-VERSION-OS mysql
shell: cd mysql
shell: scripts/mysql_install_db
shell: chown -R root .
shell: chown -R mysql data
shell: chgrp -R mysql .
shell: bin/safe_mysqld --user=mysql &
shell: bin/mysqladmin -u root shutdown
11. mysql> grant all on oscar.* to root@localhost identified by "oscar";
(always need to add this command, change localhost to your own linux computer
name.)
Installation of Tomcat - jakarta-tomcat-3.2.1.tar.gz
1. > cd /usr/local
2. > tar zxvf /home/dchan/mysql/jakarta*.tar.gz
3. Set TOMCAT_HOME, CLASSPATH, and PATH later
Edit /etc/profile
1. Add the following to the file
PATH=$PATH:/usr/java/jdk1.3/bin:/usr/local/jakarta-tomcat-3.2.1/bin:/usr/local/mysql-3.23.31-pc-linux-gnu-i686/bin
JAVA_HOME=/usr/java/jdk1.3
TOMCAT_HOME=/usr/local/jakarta-tomcat-3.2.1
export JAVA_HOME
export TOMCAT_HOME
CLASSPATH=/usr/local/mm.mysql-2.0.4/mm.mysql-2.0.4-bin.jar:/usr/java/jdk1.3/lib/servlet.jar
2. Exit and login again in the shell state
Install oscar source code
1. > cd /usr/local/jak*/we*/exam*/jsp
2. > mkdir oscar
3. > cd oscar
4. > jar xvf /home/dchan/mysql/oscar.jar (or oscar1.1.jar)
5. cd /usr/local/jak*/web*/exam*/WEB*/classes
6. > rm *.java
7. > cp /usr/local/jak*/web*/exam*/jsp/oscar/Web*/classes/*.java .
8. > javac -d . *.java
Edit /usr/local/jak*/bin/tomcat.sh
1. Add the following to the end of the file
oldCP=$CLASSPATH
CLASSPATH=${TOMCAT_HOME }webserver.jar
CLASSPATH=${CLASSPATH}:${TOMCAT_HOME}/lib/servlet.jar
CLASSPATH=${CLASSPATH}:${TOMCAT_HOME}/lib/jasper.jar
CLASSPATH=${CLASSPATH}:${TOMCAT_HOME}/lib/xml.jar
CLASSPATH=${CLASSPATH}:${JAVA_HOME}/lib/tools.jar
Start MySQL
> /usr/local/mysql*/bin/mysql -u root -pliyi oscar
> mysql> quit
Start TOMCAT
> startup.sh
|