Linux + JDK + Tomcat + MySQL + JDBC 安装手记
一、Red Hat Linux
1.分区
| swap 512 M
| /boot 100 M
10G空间 | /home 1000M
| / 2000M
| /usr 6500M
2.挂载Windows分区
# mkdir /mnt/d
# mkdir /mnt/e
# mkdir /mnt/f
# vi /etc/fstab 添加:
/dev/hda5 /mnt/d vfat defaults,codepage=936,iocharset=cp936 0 0
/dev/hda6 /mnt/e vfat defaults,codepage=936,iocharset=cp936 0 0
/dev/hda7 /mnt/f vfat defaults,codepage=936,iocharset=cp936 0 0
3.去除开机时Red Hat Linux后的版本号
# vi /boot/grub/grub.conf
删除Red Hat Linux后的版本号
二、JDK
1.下载
下载地址 http://java.sun.com/j2se/1.5.0/download.jsp
下载文件 Linux self-extracting file (jdk-1_5_0_02-linux-i586.bin)
下载到 /usr/onk
2.安装
# chmod u+x jdk-1_5_0_02-linux-i586.bin (增加用户权限)
# ./jdk-1_5_0_02-linux-i586.bin
# mv jdk-1.5.0_02 jdk
# rm -f jdk-1_5_0_02-linux-i586.bin
3.环境变量
# vi /etc/profile 添加:
export JAVA_HOME=/usr/onk/jdk
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar
三、Tomcat
1.下载
下载地址 http://jakarta.apache.org/site/downloads/downloads_tomcat-5.cgi
下载文件 jakarta-tomcat-5.5.9.tar.gz
下载到 /usr/onk
2.安装
# tar zvxf jakarta-tomcat-5.5.9.tar.gz
# mv jakarta-tomcat-5.5.9 tomcat
# rm -f jakarta-tomcat-5.5.9
3.启动与关闭
启动 # /usr/onk/tomcat/bin/startup.sh
关闭 # /usr/onk/tomcat/bin/shutdown.sh
4.开机自启动
# vi /etc/rc.d/rc.local 添加:
export JAVA_HOME=/usr/onk/jdk
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar
/usr/onk/tomcat/bin/startup.sh
5.注意
从挂载的Windows分区复制webapp文件到Linux目录下时WEB-INF文件名会变成web-inf,需要重命名为WEB-INF
四、MySQL
1.下载
下载地址 http://dev.mysql.com/downloads/mysql/4.1.html
下载文件 MySQL-server-4.1.11-0.i386.rpm MySQL-client-4.1.11-0.i386.rpm
下载到 /usr/onk
2.安装
# rpm -ivh MySQL-server-4.1.11-0.i386.rpm
# rpm -ivh MySQL-client-4.1.11-0.i386.rpm
# rm -f MySQL-server-4.1.11-0.i386.rpm
# rm -f MySQL-client-4.1.11-0.i386.rpm
3.修改口令
# mysqladmin -u root password newpassword
4.启动与关闭
启动 # /etc/init.d/mysql start
关闭 # /etc/init.d/mysql stop
5.开机自启动
查看启动列表 # /sbin/chkconfig --list
添加启动项 # /sbin/chkconfig --add mysql
删除启动项 # /sbin/chkconfig --del mysql
6.中文问题
# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
[client]下添加:
default-character-set=gbk
[mysqld]下添加:
default-character-set=gbk
7.连接数据库问题
# vi /etc/hosts
把 127.0.0.1 onizuka localhost.localdomain localhost
改为 127.0.0.1 localhost onizuka localhost.localdomain
五、JDBC
1.下载
下载地址 http://dev.mysql.com/downloads/connector/j/3.1.html
下载文件 mysql-connector-java-3.1.8.tar.gz
下载到 /usr/onk
2.安装
# tar zvxf mysql-connector-java-3.1.8.tar.gz
# cp /usr/onk/mysql-connector-java-3.1.8/mysql-connector-java-3.1.8-bin.jar /usr/onk/tomcat/common/lib
# cp /usr/onk/mysql-connector-java-3.1.8/mysql-connector-java-3.1.8-bin.jar /usr/onk/jdk/jre/lib/ext
本文地址:http://com.8s8s.com/it/it10078.htm