linux下 JDK mysql tomcat的安装

一、JDK

1. 下载并安装JDK:
下载地址 http://java.sun.com/j2se/1.5.0/download.jsp
下载文件 Linux self-extracting file (jdk-1_5_0_06-linux-i586.bin)  

# chmod u+x jdk-1_5_0_06-linux-i586.bin (增加用户权限)
# ./jdk-1_5_0_06-linux-i586.bin
# mv jdk-1.5.0_06 /usr/local
# rm -Rf jdk-1_5_0_06-linux-i586.bin
2. 配置环境变量:
在/etc/profile末尾添加如下代码:
#Java Environment
export JAVA_HOME=/usr/local/jdk-1.5.0_06
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib

要让以上环境立即生效输入命令: source /etc/profile

二、Tomcat

1. 下载和安装Tomcat
下载地址 http://jakarta.apache.org/site/downloads/downloads_tomcat-5.cgi
下载文件 jakarta-tomcat-5.5.26.tar.gz

# tar zvxf jakarta-tomcat-5.5.26.tar.gz
# mv jakarta-tomcat-5.5.26 /usr/local
# rm -f jakarta-tomcat-5.5.26

2. 配置Tomcat的环境变量(如果使用Eclipse开发环境,需要在原/etc/profile末尾加上如下代码):
#Tomcat setup
export TOMCAT_HOME=/usr/local/jakarta-tomcat-5.5.26
export CLASSPATH=$CLASSPATH:$TOMCAT_HOME/common/lib

3.启动与关闭
启动 # /usr/local/jakarta-tomcat-5.5.26/bin/startup.sh
关闭 # /usr/local/jakarta-tomcat-5.5.26/bin/shutdown.sh
4.开机自启动

# vi /etc/rc.d/rc.local 添加:
export JAVA_HOME=/usr/local/jdk-1.5.0_06
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar
/usr/local/jakarta-tomcat-5.5.26/bin/startup.sh
5.注意
    从挂载的Windows分区复制webapp文件到Linux目录下时WEB-INF文件名会变成web-inf,需要重命名为WEB-INF.

三、MySQL

1.下载
   
下载地址 http://dev.mysql.com/downloads/mysql/5.0.html
下载文件 MySQL-server-5.0.45-0.i386.rpm   MySQL-client-5.0.45-0.i386.rpm
下载到    /home/daniel
2.安装

# rpm -ivh MySQL-server-5.0.45-0.i386.rpm
# rpm -ivh MySQL-client-5.0.45-0.i386.rpm
# rm -f MySQL-server-5.0.45-0.i386.rpm
# rm -f MySQL-client-5.0.45-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   daniel localhost.localdomain localhost
改为    127.0.0.1   localhost daniel localhost.localdomain
四、JDBC

1.下载

下载地址 http://dev.mysql.com/downloads/connector/j/5.0.html
下载文件 mysql-connector-java-5.0.8.tar.gz
下载到    /home/daniel
2.安装

# tar zvxf mysql-connector-java-5.0.8.tar.gz
# cp /usr/onk/mysql-connector-java-5.0.8/mysql-connector-java-5.0.8-bin.jar /usr/local/jakarta-tomcat-5.5.26/common/lib
# cp /usr/onk/mysql-connector-java-5.0.8/mysql-connector-java-5.0.8-bin.jar /usr/lcoal/jdk-1.5.0_06/jre/lib/ext

你可能感兴趣的:(java,jdk,tomcat,mysql,linux)