当前位置:Linux教程 - RedHat - 最新RedHat 7.2 WEB开发服务器配置文档

最新RedHat 7.2 WEB开发服务器配置文档



         最新的RedHat 7.2配置文档,希望对大家有所帮助。

    最近重新配置了公司的linux开发服务器,为自己写了一份配置文档,现在共享出来,一来希望对大家有所帮助,二来希望得到各位的指正和交流。

    我发现使用Web方式的可读性较差,将它成了PDF格式,如果您需要本文档的PDF格式,可以E-mail告诉我。

    几点说明:

    我自己认为本文档优点如下:

    1、力求简明:其一,几乎没有一个步骤是多余的;其二,少说废话。

    2、步骤全面:从安装操作系统到最终完成,应该没有遗漏,初学者一步一步照做即可;服务器的配置是一个系统的过程,很多说明文档只是说明某几个软件的配置方法,没有统筹兼顾,所以初学者照搬往往失败;

    3、力求严谨:这也是我发布到这里的原因之一,这需要大家的检验;

    4、软件全新:包括操作系统在内,所有的软件都是截止到今日的最新版本;

    5、侧重JSP:以JSP 为主,可以作为JSP初学者的配置手册:其一:RH7.2增强了多语言的支持,如果你在安装的过程中选择语言时选择了i18n的简体中文包,加上Resin对中文的良好支持,你无需用声明charset(任何方式都不需要),中文自动支持,这一点文档中也已说明;其二:提供了Resin连接池的配置方法;其三:提供了添加一个虚拟主机的详细方法,从DNS FTP APACHE到Resin全面讲述;其四:指出了JDBC2.0的支持办法,并提供代码进行测试;

    6、英文书写:本身本文档的主要内容是命令和配置文件,我想还是连说明也写成英文来的干净;

    7、出错调试:提供常见问题的解决办法;

    8、编译安装:软件全部编译安装,系统可定制性较强

    我认为缺陷如下:

    1、本文档主要作为初学者的向导,当然高手也可作为参考;
    2、本文档的目标是告诉初学者如何构建一个内部开发服务器的作为自己的开发环境,如果要构建一个高性能的INTERNET服务器,需要考虑的安全因素还有很多,最起码也不能全部安装,也不需要安装X server,INTERNET 服务器不仅需要我文档中提及的功能,更需要一个简洁安全的系统;
    3、为了简明,本文档主要告诉读者如何去做,很少告诉为什么那样做,我需要说明的是,如果您忽略了其中的任何一步都可能导致出错;我有空会写一个详细一点的中文文档并做成PDF发布。
    4、服务器功能清晰:我将服务器定位在一个DNS+FTP+MYSQL+APACHE+RESIN+PHP构架的开发服务器,已经包括了作为一个WEB应用的需要,否则将造成功能混乱,初学者难以接受。所以,文档中没有提及QMAIL、ORACLE和ASP等服务的配置方法。原因一个是服务器功能的分离,一个是读者的需求,除此以外,Oracle的最佳平台是SUSE,ASP的最佳平台是win2k,至于QMAIL,后续版本可以增加进去。

    正文如下:




    Use RedHat Linux
    build your Web Develop Server


    A compendious Configure Guide for RedHat Linux 7.2
    Tell you how to use RedHat 7.2 build your web develop server step by step



    Author : Fengjun zhao
    Mail : [email protected]
    Version : 0.0.1
    Last revised : Decmber 20,2001
    Copyleft ( 2001 ) with GNU Public License.



    Copyleft ( 2001 ) with GNU Public License.

    This document is Wrote by Fengjun zhao ( [email protected]) originally in 2001-12-18,I release it with Gnu Public License. You can read、Copy、transmit and modify this document freely,but after you have modified this document,you should reserve original author and this copyleft description,record your revision at the end of this document and release it on network.



    Author : Fengjun zhao (yesgo)
    Mail : [email protected]
    Site: http://yesgo.gledecity.com
    Qq; 27565476
    Version : 0.0.1
    Last revised : Decmber 20,2001
    Copyleft ( 2001 ) with GNU Public License.








    Contents
    Copyleft ( 2001 ) with GNU Public License. 2
    Contents 3
    Tell me Your Comments 4
    Preface 5
    Software List 6
    Configure Steps 7
    Step 1 RedHat 7.2 install 7
    Step 2 X setup 7
    Step 3 Services setup 8
    Step 4 Dns setup 8
    Step 5 KDE setup 9
    Step 6 Ftp setup 9
    Step 7 MySQL、Apache and php Unistall 10
    Step 8 MySQL install 10
    Step 9 Apache configure 11
    Step 10 Php install 12
    Step 11 Apache install 12
    Step 12 Jvm setup 13
    Step 13 Classes Install 13
    Step 14 Edit /etc/profile 13
    Step 15 Resin Install 14
    Step 16 PhpMyAdmin install 17
    Step 17 Server Test 18
    Step 18 Configuration debug 21
    Appendix 24
    Appendix I : Thanks 24
    Appendix II : Todo List 24
    Appendix III: Revision log 24






    Tell me Your Comments

    I’m only a beginner on linux,this document is a note on my study way.I know my shallow very clearly, the aim of release this document is only share what I have learned with everyone,and for your suggestions.
    So I welcome your comments and suggestions on the quality and usefulness of this document. Your input is an important part of the information used for revision.
    ² Did you find any errors?
    ² Is the information clearly presented?
    ² Do you need more information? If so, where?
    ² Are the examples correct? Do you need more examples?
    ² What features did you like most?
    If you find any errors or have any other suggestions for improvement, please indicate the document
    title and part number, and the chapter, section, and page number (if available). You can send comments to me in the following ways:
    ² Electronic mail: [email protected] [email protected]
    ² Web site: http://yesgo.gledecity.com (Not available now)
    ² Forum: http://www.iuirc.com/cnjspbbs/
    ² Qq:27565476
    ² Address: ShenZhen. China

    Thank you to read this document,if you succeed by this document,congratulations! If you failed,tell me!



    Preface


    I have read many install guides for linux: such as apache+php+mysql configure guide;apache+resin+mysql、apache+tomcat+php+mysql+oracle etc.These documents is very useful but not very preciseness and all-around,or not appropriate to me,I think it’s a pity.

    My field is web develop on linux,my main attack is FreeBSD/Linux+MySQL/Oracle+JavaBean/EJB+Jsp, During the developing, we often need build a web develop server,so,I wrote this document for myself.For share my experience and get other’s comments and suggestions,I release it on the Internet.

    This is a compendious Configure Guide for Redhat Linux 7.2 without verbose description.
    According to this document step by step,you can configure a Internet/Intranet develop server with DNS、Apache、wu-ftpd、Resin、MySQL,and with php and jsp support.

    Many knowledge and experience is learned from my friends,please permit me express my pure-hearted thinksgiving for them.Mr.Jim Zhao is my torchbearer on unix and linux,it’s he lead me to touch unix and linux,he gave me lot’s of help on my study way .I also got many help from my net friends,such as Mr.axman 、 Mr.popeye and others,thinks for them too.

    Note:
    1、 The aim of this document is to build a simple web develop server,especially for beginner,if you want to use this document build a high capability Internet server,you should think about system security and do some other steps.
    2、 In this document,I only tell you how to do it,not explain why to do it.If you want a verbose manual,please waiting, I’ll do it later.
    3、 For compendious and advanced user,I write this document in English(by the way ,I’m studying English),if you have problem in English,I will distribute a chinese release,please waiting.
    4、 Color meaning:
    Deep Blue: additive content or modified content in system original profile.
    Deep Green: my notation
    5、 Symbol meaning:
    #: the symbol in system original profile.
    ##: my description for a paragraph.
    //: my description for a line.
    /*…*/:my verbose description.






    Software List
    Download the following software and put them in /home/src,you can download them on client machine,and ftp them to linux server,or directly use linux server download them and save in /home/src.
    The following software are all be used in this document,they are all lastest version upto 12/20/2001:

    RedHat 7.2
    http://redhat.pacific.net.au/redhat/linux/7.2/ja/iso/i386/
    mysql-3.23.46.tar.gz
    http://www2.linuxforum.net/mirror/mysql/Downloads/MySQL-3.23/mysql-3.23.46.tar.gz
    mm.mysql-2.0.4-bin.jar
    http://www2.linuxforum.net/mirror/mysql/Downloads/Contrib/mm.mysql-2.0.4-bin.jar
    apache_1.3.22.tar.gz
    http://www.apache.org/dist/httpd/apache_1.3.22.tar.gz
    php-4.1.0.tar.gz
    http://www.php.net/do_download.php?download_file=php-4.1.0.tar.gz
    j2sdk-1_3_1_01-linux-i386.bin
    http://java.sun.com/j2se/1.3/download-linux.html
    jaf1_0_1.zip
    http://java.sun.com/products/javabeans/glasgow/jaf.html
    javamail1_1_3.zip
    http://java.sun.com/products/javamail/javamail-1_1_3.html
    resin-2.0.4.tar.gz
    http://www.caucho.com/download/resin-2.0.4.tar.gz





    Configure Steps

    Step 1 RedHat 7.2 install
    Some suggestions:
    1、 Create a partition for /home,user data and source code will saved here,when you reinstall your redhat system,this partition could be reserved.
    2、 Use Custom mode and select “Everything” option process full install.If you want to build a internet server,you should only select necessary packages.
    3、 Select i18n chinese package,without declared in jsp source code,chinese will be supported!
    4、 Use Gnome as login manager,use KDE as default session,it’s for remote mode.
    5、 IP: 192.168.1.2,of course,you can difine it by yourself.
    6、 Default init level: 5,this make you can use remote mode to configure your system.
    --------------------------------------------------------------------------------------------
    Step 2 X setup
    vi /etc/X11/gdm/gdm.conf
    [xdmcp]
    Enable=1

    vi /etc/X11/gdm/Sessions/Default
    exec /etc/X11/xdm/Xsession kde

    vi /etc/X11/xdm/Xaccess
    192.168.1.*

    After step 2,you can use Extra!X in remote mode to configure your server.
    --------------------------------------------------------------------------------------------
    Step 3 Services setup
    Enable named 、telnet and wu_ftpd services,and disable not necessary services,be sure to close httpd and mysqld services.And then reboot your system.
    Shell> ntsysv
    --------------------------------------------------------------------------------------------
    Step 4 Dns setup
    vi /etc/named.conf

    Add a domain as following;

    ## .loc is defined by me,for avoid conflict with registed domain on internet,of course,you can use .com、.net or other postfixs.
    zone yesgo.loc{
    type master;
    file "yesgo.loc";
    }
    zone 1.168.192.in-addr.arpa{
    type master;
    file "192.168.1";
    }

    touch /var/named/yesgo.loc
    touch /var/named/192.168.1

    vi /var/named/yesgo.loc

    @ IN SOA ns.yesgo.loc. root.ns.yesgo.loc. (
    2001050801 ; Serial
    28800 ; Refresh
    14400 ; Retry
    3600000 ; Expire
    86400 ) ; Minimum
    IN NS ns.yesgo.loc.
    IN MX 0 ns.yesgo.loc.

    ns IN A 192.168.1.2
    ftp IN CNAME ns.yesgo.loc.
    mail IN CNAME ns.yesgo.loc.
    pop IN CNAME ns.yesgo.loc.
    smtp IN CNAME ns.yesgo.loc.

    vi /var/named/192.168.1

    @ IN SOA ns.yesgo.loc. root.ns.yesgo.loc. (
    2001050801 ; Serial
    28800 ; Refresh
    14400 ; Retry
    3600000 ; Expire
    86400 ) ; Minimum
    IN NS ns.yesgo.loc.
    IN MX 0 ns.yesgo.loc.

    2 IN PTR ns.yesgo.loc.

    /etc/rc.d/init.d/named restart(or ndc restart)
    nslookup
    --------------------------------------------------------------------------------------------
    Step 5 KDE setup
    Use a client machine to test the server’s telnet、ftp、named services,if these all are ok,then configure your kde.
    First following the kde setup wizard,second use kde control center,remember the color code4DOC8 and 31507B,the two color can help you set a windows 2K style environment.
    --------------------------------------------------------------------------------------------
    Step 6 Ftp setup
    vi /etc/shells
    ##Add the following line at the end of /etc/shells:
    /dev/null

    groupadd ftpchroot

    ## Add ftp users, which only have ftp right,and home directory is their root directory.
    useradd src –s /dev/null –g ftpchroot // add src user
    passwd src

    /*
    Then you can use the account and password above to upload your source,the software which you upload will save in /home/src,not /usr/local/src.why not save software in /usr/local/src? Because /home is a partition,when you reinstall your System,you can reserve this partition,so your data could be reserved.
    Of course,you can delete /usr/src,and make a symbol link for /usr/local/src:
    */

    ln –s /home/src /usr/local/src
    --------------------------------------------------------------------------------------------
    Step 7 MySQL、Apache and php Unistall
    Use Package Manager or rpm command to unistall MySQL 、Apache and Php,we’ll compile these software later.
    --------------------------------------------------------------------------------------------
    Step 8 MySQL install
    useradd mysql
    passwd mysql

    cd /home/src
    tar xvzf my*
    cd my*
    ./configure --prefix=/usr/local/mysql
    make
    make install
    ./scripts/mysql_install_db

    chown –R root /usr/local/mysql
    chgrp –R mysql /usr/local/mysql

    chown –R root /usr/local/mysql/bin
    chgrp –R mysql /usr/local/mysql/bin

    chown –R root /usr/local/mysql/var
    chgrp –R mysql /usr/local/mysql/var
    chmod 770 /usr/local/mysql/var

    chown –R root /usr/local/mysql/var/mysql
    chgrp –R mysql /usr/local/mysql/var/mysql
    chmod 770 /usr/local/mysql/var/mysql

    chown –R root /usr/local/mysql/var/mysql/*
    chgrp –R mysql /usr/local/mysql/var/mysql/*
    chmod 770 /usr/local/mysql/var/mysql/*

    chmod 770 /usr/local/mysql/lib/mysql/libmysqlclient.a

    vi /etc/ld.so.conf
    #Add the following line at the end of /etc/ld.so.conf:
    /usr/local/mysql/lib

    shell>ldconfig

    ./bin/safe_mysqld –-user=mysql &
    mysqladmin –u root –p password your_password
    mysql –p

    ##Create MySQL service
    cd /etc/rc.d/init.d
    touch mysqld
    vi mysqld
    ##Add the following lines

    #!/bin/bash
    #Start MySQL service
    cd /usr/local/mysql
    ./bin/safe_mysqld –-user=mysql

    chown –R root /etc/rc.d/init.d/mysqld
    chmod 700 /etc/rc.d/init.d/mysqld

    ln –s /etc/rc.d/init.d/mysqld /etc/rc.d/rc5.d/S60mysqld
    --------------------------------------------------------------------------------------------
    Step 9 Apache configure
    cd /home/src
    tar xvzf apa*
    cd apa*
    ./configure
    --------------------------------------------------------------------------------------------
    Step 10 Php install
    cd ..
    tar xvzf php*
    cd php*
    ./configure --with-mysql=/usr/local/mysql --with-apache=../apache_1.3.22 --enable-track-vars
    make
    make install
    cp ./php.ini-dist /usr/local/lib/php.ini
    --------------------------------------------------------------------------------------------
    Step 11 Apache install
    cd /home/src/apa*
    ./configure --prefix=/usr/local/apache --activate-module=src/modules/php4/libphp4.a --enable-module=so
    make
    make install

    ln –s /usr/local/apache/bin/apachectl /usr/bin/apache

    cd /usr/local/apache/conf
    vi httpd.conf

    ## unremark the following lines to support php3 and php4:

    # AddType application/x-httpd-php .php
    # AddType application/x-httpd-php .php3 //this line need to add by yourself
    # AddType application/x-httpd-php-source .phps

    ## Add your default pages:

    DirectoryIndex index.html index.jsp index.xtp index.php index.php3

    Shell>apache start

    ##Build Apache service:
    touche /etc/rc.d/init.d/httpd
    vi /etc/rc.d/init.d/httpd

    ## Add the following lines:

    #!/bin/bash
    #Start httpd service
    /usr/local/apache/bin/apachectl start

    chown –R root /etc/rc.d/init.d/httpd
    chmod 700 /etc/rc.d/init.d/httpd
    ln –s /etc/rc.d/init.d/httpd /etc/rc.d/rc5.d/S65httpd
    --------------------------------------------------------------------------------------------
    Step 12 Jvm setup
    cp /home/src/ j2sdk-1_3_1-linux-i386.bin /usr/local
    cd /usr/local
    chmod a+x j2sdk-1_3_1-linux-i386.bin
    ./j2sdk-1_3_1-linux-i386.bin

    ln –s /usr/local/jdk1.3.1_01 /usr/local/jvm
    --------------------------------------------------------------------------------------------
    Step 13 Classes Install
    mkdir /usr/local/lib/java //CLASS_HOME

    mkdir /usr/local/lib/java/drivers
    cp /home/src/mm.mysql-2.0.4-bin.jar.zip /usr/local/lib/java/drivers //MySQL JDBC driver

    mkdir /usr/local/lib/java/jaf
    cp /home/src/java/jaf/activation.jar /usr/local/lib/java/jaf //Jaf class

    mkdir /usr/local/lib/java/javamail
    cp /home/src/java/javamail/*.jar /usr/local/lib/java/javamail //JavaMail classes
    --------------------------------------------------------------------------------------------
    Step 14 Edit /etc/profile
    Vi /etc/profile
    ## Add the following lines at the end of /etc/profile:

    JAVA_HOME=/usr/local/jvm

    RESIN_HOME=/usr/local/resin

    CLASS_HOME=/usr/local/lib/java

    CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/jre/lib:$RESIN_HOME/lib:$CLASS_HOME/drivers/mm.mysql-2.0.4-bin.jar.zip:$CLASS_HOME/jaf/activation.jar: $CLASS_HOME/javamail/mail.jar: $CLASS_HOME/javamail /smtp.jar: $CLASS_HOME/javamail /pop3.jar: $CLASS_HOME/javamail/mailapi.jar: $CLASS_HOME/javamail/imap.jar

    PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local:/usr/local/bin:/usr/local/jvm/bin:/usr/local/jvm/jre/bin:/usr/local/mysql/bin:/usr/bin/X11:/usr/X11R6/bin

    export JAVA_HOME RESIN_HOME CLASS_HOME CLASSPATH PATH

    ##After eidt and saved /etc/profile,logout or reboot then login again,open console and enter env command view the environment parameters.

    Shell>env
    --------------------------------------------------------------------------------------------
    Step 15 Resin Install
    cd /home/src
    cp /home/src/resin-2.0.4.tar.gz /usr/local
    cd /usr/local
    tar xvzf resin*
    cd resin*
    ./configure --with-apache=/usr/local/apache
    (Or: ./configure --with-apxs=/usr/local/apache/bin/apxs)
    make
    make install

    ln –s /usr/local/resin2.0.4 /usr/local/resin
    ln –s /usr/local/resin/bin/httpd.sh /usr/bin/jsp

    vi /usr/local/resin/conf/resin.conf

    Modify One: create data source name(DSN)



    org.gjt.mm.mysql.Driver
    jdbc:mysql://localhost/database_name

    user_name
    password
    100




    Modify Two: modify default root directory
    /usr/local/apache/htdocs

    Modify Three: modify resin port
    annotate or delete it!

    Modify Four: Add virtual host with jsp support
    ## Add a Virtual Host need four steps: DNS、FTP、RESIN、APACHE

    1、Add a CNAME
    vi /var/named/yesgo.loc
    # add the following line at the end:
    www IN CNAME ns.yesgo.loc.
    /etc/rc.d/init.d/named restart
    nslookup
    2、Add a ftp account:
    Useradd www –s /dev/null –g ftpchroot
    Passwd www
    Chmod 701 /home/www
    3、Configure resin.conf
    vi /usr/local/resin/conf/resin.conf


    /home/www


    [ Attention! ]:
    You set your resin classpath is classes,so you should put your JavaBeans under the directory.
    4、configure httpd.conf
    vi /usr/local/apache/conf/httpd.conf

    # Name the IP address which Virtual Host build on
    NameVirtualHost 192.168.1.2

    # Add virtual host
    www.yesgo.loc>
    ServerAdmin [email protected]
    DocumentRoot /home/www
    ServerName www.yesgo.loc
    ErrorLog logs/www.yesgo.loc-error_log
    CustomLog logs/www.yesgo.loc -access_log common


    ##build resin service:
    touch /etc/rc.d/init.d/resin
    chmod 701 /etc/rc.d/init.d/resin
    ln –s /etc/rc.d/init.d/resin /etc/rc.d/rc5.d/S70resin
    vi /etc/rc.d/init.d/resin

    ##the content is:

    #!/bin/bash
    #Set environment parameter:

    JAVA_HOME=/usr/local/jvm

    RESIN_HOME=/usr/local/resin

    CLASS_HOME=/usr/local/lib/java

    CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/jre/lib:$RESIN_HOME/lib:$CLASS_HOME/drivers/mm.mysql-2.0.4-bin.jar.zip:$CLASS_HOME/jaf/activation.jar: $CLASS_HOME/javamail/mail.jar: $CLASS_HOME/javamail /smtp.jar: $CLASS_HOME/javamail /pop3.jar: $CLASS_HOME/javamail/mailapi.jar: $CLASS_HOME/javamail/imap.jar

    PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local:/usr/local/bin:/usr/local/jvm/bin:/usr/local/jvm/jre/bin:/usr/local/mysql/bin:/usr/bin/X11:/usr/X11R6/bin

    export JAVA_HOME RESIN_HOME CLASS_HOME CLASSPATH PATH

    #Start resin web server
    exec /usr/local/resin/httpd.sh start

    shell>jsp start
    shell>apache restart
    --------------------------------------------------------------------------------------------
    Step 16 PhpMyAdmin install
    tar xvzf /home/src/phpMy*
    cp /www/phpMyAdmin/* /home/mysql
    chown –R mysql /home/mysql
    chown –R mysql /home/mysql/*
    chmod 701 /home/mysql
    chmod 701 /home/mysql/*

    ##Add authentication
    vi config.inc.php3

    $cfgServers[1][host] = localhost;
    $cfgServers[1][port] = \;
    $cfgServers[1][adv_auth] = 1;
    $cfgServers[1][stduser] = oot;
    $cfgServers[1][stdpass] = your_password;
    $cfgServers[1][user] = oot;
    $cfgServers[1][password] = your_passwore;
    $cfgServers[1][only_db] = \;
    $cfgServers[1][verbose] = \;

    #Add Virtual Host
    vi /usr/local/apache/conf/httpd.conf


    ServerAdmin [email protected]
    DocumentRoot /www/mysql.yesgo.loc
    ServerName mysql.yesgo.loc
    ErrorLog logs/mysql.yesgo.loc-error_log
    CustomLog logs/mysql.yesgo.loc-access_log common


    apache restart
    --------------------------------------------------------------------------------------------
    Step 17 Server Test
    ## Why not to use 1+1=<%=1+1%>? The answer is:this sample can test MySQL、Resin、Apache、JDBC、MySQL JDBC Driver、Chinese problem etc.In a word,this test is very all-around.

    1、Create Database
    ## create the sql script as following:
    create database servertest
    use servertest;

    create table prov
    (
    prov_id tinyint(2) not null primary key,
    prov_name char(6) not null
    );

    insert into prov values (,安徽);
    insert into prov values (,北京);
    insert into prov values (,重庆);
    insert into prov values (,福建);
    insert into prov values (,甘肃);
    insert into prov values (,广东);
    insert into prov values (,广西);
    insert into prov values (8,贵州);
    insert into prov values (9,海南);
    insert into prov values (10,河北);
    insert into prov values (11,黑龙江);
    insert into prov values (12,河南);
    insert into prov values (13,湖北);
    insert into prov values (14,湖南);
    insert into prov values (15,内蒙古);
    insert into prov values (16,江苏);
    insert into prov values (17,江西);
    insert into prov values (18,吉林);
    insert into prov values (19,辽宁);
    insert into prov values (20,宁夏);
    insert into prov values (21,青海);
    insert into prov values (22,山西);
    insert into prov values (23,陕西);
    insert into prov values (24,山东);
    insert into prov values (25,上海);
    insert into prov values (26,四川);
    insert into prov values (27,天津);
    insert into prov values (28,西藏);
    insert into prov values (29,新疆);
    insert into prov values (30,云南);
    insert into prov values (31,浙江);
    insert into prov values (32,香港);
    insert into prov values (33,澳门);
    insert into prov values (34,台湾);

    2、Add user for database
    mysql –p
    mysql> grant all privileges on servertest.* to your_user_name@localhost identified by ‘your_password’ with grant option;
    mysql> grant all privileges on servertest.* to your_user_name@’ns.yesgo.loc’ identified by ‘your_password’ with grant option;
    mysql> grant all privileges on servertest.* to your_user_name@’192.168.1.2’ identified by ‘your_password’ with grant option;
    mysql> grant all privileges on servertest.* to your_user_name@’%’ identified by ‘your_password’ with grant option;
    mysql>exit

    3、Create index.jsp
    touch /home/www/index.jsp
    chown –R www /home/www/index.jsp
    chgrp –r root /home/www/index.jsp
    chmod 771 /home/www/index.jsp
    vi test.jsp
    ## the source code is:

    <%@ page language="java" import="java.sql.*"%>

    <%
    Class.forName ("org.gjt.mm.mysql.Driver");
    Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/eidrp","hongze","sinotoy.com");
    Statement stmt = conn.createStatement();
    String strSql="select * from prov";
    ResultSet rs=stmt.executeQuery(strSql);
    rs.next();
    out.print(rs.getString("prov_id")+" "+rs.getString("prov_name")+"
    ");
    rs.last();
    out.print(rs.getString("prov_id")+" "+rs.getString("prov_name")+"
    ");
    stmt.close();
    conn.close();
    %>
    4、browse it
    lynx http://www.yesgo.loc (or:lynx http://www.yesgo.loc/index.jsp)
    ##the correct result should be:

    1 安徽
    34 台湾

    ## If the result is the above,congratulation!you succeed.
    ## Of course,you can also create a php file to test php:
    touch /home/www/test.php
    chmod 701 /home/www/test.php

    vi test.php
    ## the source code is:
    phpinfo();
    ?>
    lynx http://www.yesgo.loc/test.php
    --------------------------------------------------------------------------------------------
    Step 18 Configuration debug

    ##After run lynx http://www.yesgo.loc, system perhaps give you some error message.
    The proberbly error message is:

    Error I:
    Forbidden
    You don have permission to access / on this server.

    Apache/1.3.22 Server at www.yesgo.loc Port 80

    Possible Reasons:
    1、 You haven’t set right for guest user.
    2、 You haven’t set default page.
    Solution:
    chmod 701 /home/www
    chmod 701 /home/www/*

    vi /usr/local/apache/conf/httpd.conf
    DirectoryIndex index.html index.jsp index.xtp index.php index.php3
    Error II:
    404 Not Found
    /index.jsp was not found on this server.

    Resin 2.0.4 (built Thu Nov 15 17:56:24 PST 2001)

    Possible Reasons:
    1、You haven’t configure the virtual host both resin.conf and httpd.conf
    2、you give a error file name to server
    Solution:
    1、 check your file name,attention uppercase and lowercase;
    2、 check both httpd.conf and resin.conf have add the virtual host.

    Error III:
    500 Servlet Exception
    java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
    at com.caucho.util.DynamicClassLoader.loadClass(DynamicClassLoader.java:479)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:120)
    at _cnmysql__jsp._jspService(/cnmysql.jsp:4)
    at com.caucho.jsp.JavaPage.service(JavaPage.java:74)
    at com.caucho.jsp.Page.subservice(Page.java:485)
    at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:176)
    at com.caucho.server.http.Invocation.service(Invocation.java:278)
    at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:129)
    at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:338)
    at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:270)
    at com.caucho.server.TcpConnection.run(TcpConnection.java:140)
    at java.lang.Thread.run(Thread.java:484)

    Resin 2.0.4 (built Thu Nov 15 17:56:24 PST 2001)

    Possible Reasons:
    1、You haven’t install this driver.
    2、you haven’t set classpath in /etc/profile
    Solution:
    See also Classes Install and edit /etc/profile above.
    Error IV:
    500 Servlet Exception
    java.sql.SQLException: Invalid authorization specification: Access denied
    for user: [email protected] (Using password: YES)
    at org.gjt.mm.mysql.MysqlIO.init(MysqlIO.java:330)
    at org.gjt.mm.mysql.Connection.connectionInit(Connection.java:261)
    at org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Connection.java:89)
    at org.gjt.mm.mysql.Driver.connect(Driver.java:167)
    at java.sql.DriverManager.getConnection(DriverManager.java:517)
    at java.sql.DriverManager.getConnection(DriverManager.java:177)
    at _cnmysql__jsp._jspService(/cnmysql.jsp:5)
    at com.caucho.jsp.JavaPage.service(JavaPage.java:74)
    at com.caucho.jsp.Page.subservice(Page.java:485)
    at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:176)
    at com.caucho.server.http.Invocation.service(Invocation.java:278)
    at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:129)
    at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:338)
    at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:270)
    at com.caucho.server.TcpConnection.run(TcpConnection.java:140)
    at java.lang.Thread.run(Thread.java:484)

    Resin 2.0.4 (built Thu Nov 15 17:56:24 PST 2001)
    Possible Reasons:
    1、database host、user or password set error
    2、you input incorrect host、user or password.
    Solution:
    1、 see also Modify four in Resin Install;
    2、 check your host、user or password in source code.
    3、 Attention: don’t forget compare your host in code with in mysql db.

    Error IV:
    500 Servlet Exception
    java.lang.AbstractMethodError
    at _cnmysql__jsp._jspService(/cnmysql.jsp:11)
    at com.caucho.jsp.JavaPage.service(JavaPage.java:74)
    at com.caucho.jsp.Page.subservice(Page.java:485)
    at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:176)
    at com.caucho.server.http.Invocation.service(Invocation.java:278)
    at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:129)
    at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:338)
    at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:270)
    at com.caucho.server.TcpConnection.run(TcpConnection.java:140)
    at java.lang.Thread.run(Thread.java:484)

    Resin 2.0.4 (built Thu Nov 15 17:56:24 PST 2001)

    Possible Reasons:
    1、the version of your jvm is to low,jdbc version is 1.0;
    2、mysql jdbc Driver doesn’t support jdbc 2.0;
    Solution:
    1、 upgrade your jvm,my suggestion is j2sdk-1_3_1_01-linux-i386.bin;
    2、 replace mysql_comp.jar with mm.mysql-2.0.4-bin.jar.zip




    Appendix
    Appendix I : Thanks
    Friends:
    Many knowledge and experience is learned from my friends,please permit me express my pure-hearted thinksgiving for them.Mr.Jim Zhao is my torchbearer on unix and linux,it’s he lead me to touch unix and linux,he gave me many help on my study way.I also get many help from my net friends,such as Mr.axman 、 Mr.popeye and others,thinks for them too.

    Sites:
    I also have gotten many resource and knowledge from technic web site,such as :
    http://www.cnjsp.net
    http://www.linuxaid.com.cn
    http://www.linuxbyte.net
    http://www.linuxforum.net
    thinks for them too.

    Appendix II : Todo List
    1、 Give a verbose description;
    2、 Distrabute simplified chinese release;
    3、 Cstom package,don’t install everything.install only necessary packages;
    4、 Don’t install X,use init 3 not init 5
    5、 Enhance system security.

    Appendix III: Revision log
    12/20/01 distrabute the first release: language:English,version 0.0.1;
    发布人:叶三耿 来自: