这是在下在这一段时间配置积累下的一点经验,测试是绝对通过的了,我用的服务器是RedHatLinuxAS3.0,服务器在安装时没有安装这些软件,如果你先前安装得有这些,请先卸掉后再装,我想在Redhat9.0,8.0应该没有问题吧,不过需要大家测试一下!1、安装JDK1)
这是在下在这一段时间配置积累下的一点经验,测试是绝对通过的了,我用的服务器是RedHat Linux AS
3.0,服务器在安装时没有安装这些软件,如果你先前安装得有这些,请先卸掉后再装 ,我想在Redhat 9.0,8.0
应该没有问题吧,不过需要大家测试一下!
1、安装JDK
1)、从sun上载最新jdk,正常的安装
./j2sdk-1_4_2_03-linux-i586.bin
rpm -ivh j2sdk-1_4_2_03-linux-i586.rpm
2)、为了以后升级方便,最好建一个软连接, 命令:ln -s /usr/java/j2sdk-1_4_2_03
/usr/local/jdk
2、安装Apache
1). 下载最新的:
http://www.apache.org/dist/httpd/httpd-2.0.47.tar.gz
2). 解包:
tar xvfz httpd-2.0.47.tar.gz
3). 安装:
cd httpd-2.0.47
./configure --prefix=/usr/local/apache --enable-so
make
make install
4). 修改httpd.conf:
vi /usr/local/apache/conf/httpd.conf
DirectoryIndex后加上index.php
加一行 AddType application/x-httpd-php .php .phtml .php3 .inc
加一行 LoadModule php4_module modules/libphp4.so
(如果后面要安装最新php,它会自动来加上这个,如果您不安装php那么这个也就不要加上,要不会报错的哦)
AddDefaultCharset后改为GB2312
5). 启动时运行:
vi /etc/rc.d/rc.local 加一行 /usr/local/apache/bin/apachectl
start
3、安装Mysql
1)、下载最新的安装包,请最好安装RPM包,这样最方便,又好用,我安的是这两个包MySQL-server-4.0.13-0.i386.rpm
MySQL-client-4.0.13-0.i386.rpm,请从mysql.com上面下载。
2)、rpm -ivh MySQL-server-4.0.13-0.i386.rpm
rpm -ivh MySQL-client-4.0.13-0.i386.rpm
4、安装Php
1). 下载最新的:
http://www.php.net/get/php-4.3.4.tar.gz/from/this/mirror
2). 解包:
tar xvfz php-4.3.4.tar.gz
3). 安装:
cd php-4.3.4
./configure --with-mysql --with-apxs2=/usr/local/apache/bin/apxs
--enable-track-vars --with-gd --with-zlib --with-xml
make
make install
cp php.ini-dist /usr/local/lib/php.ini
5、安装Tomcat 5
1)、下载最新的tomcat 5
http://www.apache.org/dist/jakarta/tomcat-5/v5.0.16/bin/jakarta-tomcat-5.0.16.tar.gz
2)、解包 tar xvfz jakarta-tomcat-5.0.16.tar.gz
3)、 mv jakarta-tomcat-5.0.16 /usr/local/
ln -s /usr/local/jakarta-tomcat-5.0.16 /usr/local/tomcat/
vi /usr/local/tomcat/bin/catalina.sh (操作时请注意备份哦)
打开catalina.sh后,在第三行后插入这几行:
JAVA_HOME=/usr/local/jdk/
CATALINA_HOME="/usr/local/tomcat/"
JAVA_OPTS="-Xms256m -Xmx256m"
然后存盘退出。
4)、现在你可以使用/usr/local/tomcat/bin/startup.sh
/usr/local/tomcat/bin/shutdown.sh 来启动或停止tomcat服务了
5)、groupadd tomcat
useradd -g tomcat -c "Tomcat User" -d /usr/local/tomcat
tomcat
passwd tomcat
chown -R tomcat:tomcat /usr/local/tomcat
chown -R tomcat:tomcat /usr/local/jakarta-tomcat-5.0.16
6). 启动时运行:
vi /etc/rc.d/rc.local 加一行 su - tomcat -c
/usr/local/tomcat/bin/startup.sh
6、安装JK2 (这是比较重要的东东,看清楚哦,这里最容易出问题了)
1)、下载最新的JK2
http://www.apache.org/dist/jakarta/tomcat-connectors/jk2/jakarta-tomcat-connectors-jk2-src-current.tar.gz
2)、解包 tar xvfz
jakarta-tomcat-connectors-jk2-src-current.tar.gz
3)、
cd jakarta-tomcat-connectors-jk2/jk/native
./buildconf.sh
./configure --with-apxs2=/usr/local/apache/bin/apxs
make
make install
cp jk/build/jk2/apache2/mod_jk2.so /usr/local/apache/modules
cp jk/build/jk2/apache2/jkjni.so /usr/local/apache/modules
4)、把mod_jk2加入 httpd.conf中 vi
/usr/local/apache/conf/httpd.conf
LoadModule jk2_module modules/mod_jk2.so
5)、vi /usr/local/tomcat/conf/jk2.properties 把原有位置的相关文件换成下面这些
# list of needed handlers.
handler.list=channelSocket,request
# Override the default port for the channelSocket
channelSocket.port=8009
6)、vi /usr/local/apache/conf/workers2.properties
这个是我的配置文件,请参考着修改
# only at beginnin. In production uncomment it out
[logger.apache2]
level=DEBUG
[shm]
file=/usr/local/apache/logs/shm.file
size=1048576
# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
# Uri mapping
[uri:128.100.1.49/*.jsp]
worker=ajp13:localhost:8009
[uri:www.server110.com/*.jsp]
worker=ajp13:localhost:8009
[uri:www.friendlist.cn/*.jsp]
worker=ajp13:localhost:8009
[uri:www.cnho.com/*.jsp]
worker=ajp13:localhost:8009
# only at beginnin. In production uncomment it out
[logger.apache2]
level=DEBUG
[shm]
file=/usr/local/apache/logs/shm.file
size=1048576
# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
# Uri mapping
[uri:128.100.1.49/*.jsp]
worker=ajp13:localhost:8009
[uri:www.server110.com/*.jsp]
worker=ajp13:localhost:8009
[uri:www.friendlist.cn/*.jsp]
worker=ajp13:localhost:8009
[uri:www.cnho.com/*.jsp]
worker=ajp13:localhost:8009
7)http.conf 虚拟主机配置部分
#…………
#不相关的部分已经省略
NameVirtualHost *
ServerAdmin support@cnho.com
DocumentRoot /www/ebuddylist/web-4sx593/
ServerName www.friendlist.cn
ServerAlias *.friendlist.cn friendlist.cn ebuddylist.com
*.ebuddylist.com
ErrorLog logs/www.friendlist.cn-error_log
CustomLog logs/www.friendlist.cn-access_log common
Options None
ServerAdmin support@cnho.com
DocumentRoot /www/cnho/html/
ServerName www.cnho.com
ServerAlias *.cnho.com cnho.com
ErrorLog logs/www.cnho.com-error_log
CustomLog logs/www.cnho.com-access_log common
Options None
ServerAdmin support@cnho.com
DocumentRoot /www/lawcn/asdf-web/
ServerName www.server110.com
ServerAlias *.server110.com server110.com
ErrorLog logs/server110.com-error_log
CustomLog logs/server110.com-access_log common
Options None
JkUriSet worker ajp13:localhost:8009
、server.xml 的配置
debug="0"/>
debug="0"/>
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and
saved">
factory
org.apache.catalina.users.MemoryUserDatabaseFactory
pathname
conf/tomcat-users.xml
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" cOnnectionTimeout="20000"
disableUploadTimeout="true" />
enableLookups="false" redirectPort="8443" debug="0"
protocol="AJP/1.3" />
prefix="catalina_log." suffix=".txt"
timestamp="true"/>
debug="0" resourceName="UserDatabase"/>
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
directory="logs" prefix="lawcn_log." suffix=".txt"
timestamp="true"/>