查看单个帖子
旧 09-01-2008, 08:15   #1
chyangwa
蝌蚪-小毛驴
 
chyangwa的头像
 
注册日期: Nov 2000
来自: 上海
帖子: 8,285
精华: 6
Pure-ftpd+mysql架设FTP服务器[未验证]

Pure-ftpd+mysql架设FTP服务器[未验证]
原文用RedHat Linux9 AS3,mysql 4.0.20

*****系统环境 RedHat Linux9 系统,自带的Mysql数据库********

安装前提:配置好Apache+cgi+php+perl+mysql

软件准备:

下载mysql并安装好(参考:5MySQL的安装配置)

修改mysql用户root的口令,本例口令为:123456

# mysqladmin -u root password 123456

软件包:
1、pure-ftpd-1.0.20.tar.gz
2、webpureftp0.1.rar
3、ZendOptimizer-2[1].5.7-linux-glibc21-i386.tar.gz
4、pureftpd_php_manager.tar————(可以选择不安装)
5、rarlinux-3.4.0.tar.gz (rar 压缩、解压缩软件)

www.rarlab.com/rar/rarlinux-3.4.0.tar.gz

首先安装压缩、解压缩软件Rar:rarlinux-3.4.0.tar.gz

# tar zxvf rarlinux-3.4.0.tar.gz (生成 rar目录)
# cd rar
# make install

---- ----- -------- -------------- -------------

下载Pure-ftpd,http://fresh.t-systems-sfr.com/unix/src/misc
/.warix/pure-ftpd-1.0.20.tar.gz.html

下载web管理工具: webpureftp0.1.rar http://www.lishiqin.cn/download.php

下载 ZendOptimizer (必须安装,用来给webpureftp0.1.rar解密)

*********************************开始安装***********************************

一、pure-ftpd的安装配置

1、解压缩:
# tar zxvf pure-ftpd-1.0.20.tar.gz
生成 pure-ftpd-1.0.20 目录

2、编译安装:
# cd pure-ftpd-1.0.20
# ./configure \ (编译,下面是要自己写的编译条件)
> --prefix=/usr/local/pureftpd \
--with-mysql \ --with-mysql=/usr/local/mysql \ 此处的 /usr/local/mysql
请改为你的mysql实际安装路径.
--with-virtualchroot \
--with-virtualhosts \
--with-virtualroot \
--with-diraliases \
--with-uploadscript \
--with-cookie \
--with-quotas \
--with-sysquotas \
--with-ratios \
--with-ftpwho \
--with-throttling \
--with-largefile \
--with-peruserlimits \
--with-paranoidmsg \
--with-welcomemsg \
----------------------------------------------------------------------------------
--with-puredb \ ---------->>这个可别忘记了,我就是因为忘记了这个,结果浪费了很多时间
--with-pam \
--with-shadow \ (需要参考是否增加这三行)
------------------------------------------------------------------------------------
--with-language=simplified-chinese (没有斜杠了,结束!)
traditional-chinese BIG5繁体中文
# make
# make install

MYSQL用RPM方式安装

./configure --prefix=/usr/local/pureftpd --with-mysql --with-virtualchroot --with-virtualhosts --with-virtualroot --with-diraliases --with-uploadscript --with-cookie --with-quotas --with-sysquotas --with-ratios --with-ftpwho --with-throttling --with-largefile --with-peruserlimits --with-paranoidmsg --with-welcomemsg --with-puredb --with-pam --with-shadow --with-language=simplified-chinese

MYSQL用编译方式安装(没有成功,建议用MYSQL用RPM方式安装)
./configure --prefix=/usr/local/pureftpd --with-mysql=/usr/local/mysql --with-virtualchroot --with-virtualhosts --with-virtualroot --with-diraliases --with-uploadscript --with-cookie --with-quotas --with-sysquotas --with-ratios --with-ftpwho --with-throttling --with-largefile --with-peruserlimits --with-paranoidmsg --with-welcomemsg --with-puredb --with-pam --with-shadow --with-language=simplified-chinese

--with-mysql=/usr/local/mysql \ 此处的 /usr/local/mysql 请改为你
的mysql实际安装路径.如果出现类似

configure: error: Your MySQL client libraries aren't properly installed 的错误,
请将mysql目录下的 include/mysql下的mysql.h文件以及lib/mysql下的全部文件,
连接(直接复制过去或许也可)到 /usr/lib 目录下

****************** **************** *****************

安装好以后:

# cd configuration-file (进入configuration-file目录)

// 将pure-config.pl文件复制到/usr/local/pureftpd/sbin/下面

# cp pure-config.pl /usr/local/pureftpd/sbin/

// 更改pure-config.pl文件权限,变成可执行文件

# chmod u+x /usr/local/pureftpd/sbin/pure-config.pl

----------------------------------------------------------------------------

二、生成pure-ftpd服务管理脚本

1、编辑文件 :redhat.init 目录,注意寻找文件的位置

一般就在pure-ftpd-1.0.20的安装目录下面:

# cd contrib

# vi redhat.init

找到:fullpath=/usr/local/sbin/$prog

改成:fullpath=/usr/local/pureftpd/sbin/$prog

找到:pureftpwho=/usr/local/sbin/pure-ftpwho

改成:pureftpwho=/usr/local/pureftpd/sbin/pure-ftpwho


2、将文件redhat.init复制到/etc/init.d目录,并重命名为:pure-ftpd

# cp redhat.init /etc/init.d/pure-ftpd

然后设置文件可以执行

# chmod +x /etc/init.d/pure-ftpd

添加pure-ftpd服务到系统中,使可以和系统同时启动

# chkconfig --add pure-ftpd
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --


****建立FTP目录****

如在根目录下面建立 ftproot 目录

# mkdir /ftproot

______________________________________________________

三、WebPureftpd的安装和使用

首先安装ZendOptimizer,先将ZendOptimizer-2[1].5.7-linux-glibc21-i386.tar.gz

# tar zxvf ZendOptimizer-2[1].5.7-linux-glibc21-i386.tar.gz
生成 :ZendOptimizer-2.5.7-linux-glibc21-i386 目录


# cd ZendOptimizer-2.5.7-linux-glibc21-i386
# ./install.sh (安装)


———————————————出现安装界面————————————————————

安装过程很简单,只要根据自己的系统实际情况回答问题就可以了。

1、确定接受安装协议

2、****Spscify the location where to install Zend Optimizer(指定安装路径)
/usr/local/Zend

# 可以使用Zend给出的默认安装路径,或按自己需要修改

3、****Confirm the location of your php.ini file
/etc
# 如果不是默认路径,那按实际情况修改

****Spscify the full path to the Apache binary(给出完整的Apache执行文件路径)

/usr/sbin/httpd # 系统默认Apache的执行文件路径:
# 如果不是默认路径,那按实际情况修改

安装完成后要重启 Web Server,使配置生效!
# service httpd restart

------------------------------------------------------------------------------
1、生成MYSQL 数据库

解压安装WebPureftpd (已经安装了RAR解压缩软件)

# unrar x webpureftp0.1.rar ./ ---表示解压到当前目录(用RAR解压缩)

生成----- pureftp 目录


然后从别的地方拷贝docs.tar.gz 和SQL.tar.gz到pureftp目录,并解压缩。

# cp docs.tar.gz /root/ftptools/pureftp
# cp SQL.tar.gz /root/ftptools/pureftp
# cd pureftp
# tar zxvf docs.tar.gz
# tar zxvf SQL.tar.gz

原来在RedHat 9 环境中,没有找到 SQL 目录,

# cd SQL
# vi pureftp_db_0.1.sql

找到语句 DROP TABLE IF EXISTS `depart_info;
在该语句前加入下面两条语句

CREATE DATABASE pureftp;
USE pureftp;

——————————————————------------------------——————
执行下面的命令生成MYSQL数据库

# cd pureftp
# service mysqld restart
# mysql -u root -p < SQL/pureftp_db_0.1.sql
/usr/local/mysql/bin/mysql -u root -p < SQL/pureftp_db_0.1.sql

输入mysql的root用户口令后,即可自动生成pure-ftpd使用的数据库。

用Webmin查看生成了pureftp数据库。生成了4个数据表。



———————————————————————————————————

2、生成pure-ftpd的配置文件

进入Webpureftpd的解压目录,编辑配置文件:docs/pureftpd-mysql.conf
奇怪找不到doc目录
# cd /root/ftptools/pureftp/docs
# vi pureftpd-mysql.conf

找到:MYSQLUser network
改成:MYSQLUser root

找到:MYSQLPassword 123456
改成:MYSQLPassword 123456 (23072941是MYSQL的口令)

--------------------------------------------
在RedHat 9 环境中,没有找到 docs 目录

将pure-ftpd.conf和pureftpd-mysql.conf复制到/etc目录下面#######

# cp pure-ftpd.conf /etc
# cp pureftpd-mysql.conf /etc

-------------------------------------------------------------------------

3、配置pure-ftpd的参数

# cd config
# vi config.inc.php 编辑文件

找到:$default_ftp_root="/data/ftp";将其修改成FTP的实际目录,即自己建立的FTP目录
改成:$default_ftp_root="/ftproot/";------在前面已经建立了。
mkdir /ftptools
注意必须在目录后面加:"/"。

找到:$obj_db=new db("localhost","root","","pureftp");

改成:$obj_db=new db("localhost","root","123456","pureftp");
"root"后面的" "填入数据库口令
-----------------------------------------------------------------------------

4、将pureftp目录放置在Apache的主目录中,才能通过Web方式配置pure-ftpd服务器。

默认Apache的主目录在:/var/www/html

# cp -r -f pureftp /var/www/html (移动pureftp目录到/var/www/html)
# cp -r -f pureftp /usr/local/apache/htdocs
------------------------------------------------------------------------------
chyangwa离线中   回复时引用此帖