你最好也要装一下
apache+php+phpmyadmin
这样要练习就方便多了..
将下列软件下载到/tmp目录。
1.mysql-4.0.20.tar.gz 下载地址:
http://downloads.mysql.com/ar....0.20.tar.gz2.apache 下载地址:
http://apache.mirrors.hoobly.....0.52.tar.gz3.php 下载地址:
http://www.php.net/get/php-5....p.net/mirror4.phpMyAdmin-2.6.0-rc3下载地址:
http://xj-http.skycn.net:8080...0-rc3.tar.gz5.pureftpd 下载地址:
ftp://ftp.pureftpd.org/pure-....0.20.tar.gz6.pureftpd_php_manager下载地址:
http://www.fuwu.net.cn/soft/u...nager.tar.gzcd /tmp
1.先安装mysql
tar zxvf mysql-4.0.20.tar.gz
cd mysql-4.0.20
#./configure --prefix=/usr/local/mysql --localstatedir=/var/mysql/data
#make
#make install
#cd /usr/local/mysql/bin
#./mysql_install_db
#useradd mysql
#chown -R mysql:mysql /usr/local/mysql
#chown -R mysql:mysql /var/mysql
#./mysqld_safe -u root & (启动mysql)
#./mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 4.0.20
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
如果能看到上面的信息,那么mysql的安装就OK了。
# ./mysqladmin -u root password 『123456』 (默认密码为空自己添加一个吧)
# cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
#chown -R mysql:mysql /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld (将mysql添加进自启动服务列表里)
#ntsysv (选中myslqd 则每次系统启动都能启动mysql)
2.安装apache
cd /tmp
tar zxvf httpd-2.0.52.tar.gz
cd httpd-2.0.52
#./configure –enable-so –enable-rewrite
#make
#make install
编译安装完成后,启动apache
#cd /usr/local/apache2/bin
#./apachectl start
这样就启动了apache服务器
vi /etc/rc.d/rc.local在里面添加这么一行/usr/local/apache2/apachectl start (让apche随系统启动)
mkdir /var/www/html
vi /usr/local/apache2/conf/httpd.conf
308行DocumentRoot "/var/www/html"
333行<Directory "/var/www/html">
3.安装php5.0
在安装php之前先把libxml2安装上,否则安装php5.0会出错的。
下载地址:http://www.fuwu.net.cn/soft/uploads...l2-2.6.8.tar.gz (保存在/tmp目录里)
cd /tmp
tar zxvf libxml2-2.6.8.tar.gz
cd libxml2-2.6.8
# ./configure
# make
# make install
编译安装成功后即可
cd /tmp
tar zxvf php5.0.tar.gz
cd php-5.0.0
#./configure–with-apxs2=/usr/local/apache2/bin/apxs –with-mysql=/usr/local/mysql
# make
# make install
安装完成后,修改apache的配置文件httpd.conf
在相应的位置加入以下语句:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php .php3
重启apache即可;
测试PHP
编写 info.php文件,内容如下:
<?php
echo phpinfo();
?>
将其存放在/var/www/html目录下,在浏览器中输入:
http://127.0.0....o.php如果能看到php的配置信息,就表示以上的配置成功!
4.解压phpMyAdmin-2.6.0-rc3.tar.gz
cd /tmp
tar zxvf phpMyAdmin-2.6.0-rc3.tar.gz
cp -R phpMyAdmin-2.6.0-rc3 /var/www/html/phpmyadmin
cd /var/www/html/phpmyadmin
vi config.inc.php
将83行的config改为http保存退出。
http://你的IP/phpmyadmin/
用户名:root
密码:123456 (配置mysql时所设置的)
能看见mysql数据库信息则表示配置成功!
5.安装pureftpd-ftpd-1.0.21
cd /tmp
tar zvxf pure-ftpd-1.0.21.tar.gz
cd pure-ftpd-1.0.21
#./configure --prefix=/usr/local/pureftpd --with-mysql=/usr/local/mysql --with-paranoidmsg --with-shadow --with-welcomemsg --with-uploadscript --with-quotas --with-cookie --with-pam --with-virtualhosts --with-virtualroot --with-diraliases --with-sysquotas --with-ratios --with-ftpwho --with-throttling --with-language=simplified-chinese
make
make check
make install
cd configuration-file
chmod u+x pure-config.pl
cp pure-config.pl /usr/local/sbin/
cp pure-ftpd.conf /usr/local/etc/
vi /usr/local/etc/pure-ftpd.conf
按你的需要编辑pure-ftpd.conf
# Cage in every user in his home directory
# 限制每个用户到自己的根目录
ChrootEveryone yes
# Disallow anonymous connections. Only allow authenticated users.
# 取消anonymous用户
NoAnonymous yes
# MySQL configuration file (see README.MySQL)
# pureftpd-mysql.conf文件的位置
MySQLConfigFile /usr/local/etc/pureftpd-mysql.conf
#自己创建用户目录
CreateHomeDir yes
#让pure-ftpd随系统启动
#cd ..
# cp ./contrib/redhat.init /etc/init.d/pureftpd
# vi /etc/init.d/pureftpd
#!/bin/bash
#
# Startup script for the pure-ftpd FTP Server $Revision: 1.3 $
#
# chkconfig: 2345 85 15
# description: Pure-FTPd is an FTP server daemon based upon Troll-FTPd
# processname: pure-ftpd
# pidfile: /var/run/pure-ftpd.pid
# config: /usr/local/etc/pure-ftpd.conf
# Source function library.
. /etc/rc.d/init.d/functions
RETVAL=0
# Path to the pure-ftp binaries.
prog=pure-config.pl
fullpath=/usr/local/sbin/$prog
pureftpwho=/usr/local/pureftpd/sbin/pure-ftpwho
start() {
echo -n $"Starting $prog: "
$fullpath /usr/local/etc/pure-ftpd.conf --daemonize
RETVAL=$?
[ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
echo
}
. . . . . . . .
. . . . . . . . . .略
# chmod 755 /etc/init.d/pureftpd
# chown root:root /etc/init.d/pureftpd
# chkconfig --add pureftpd
# chkconfig pureftpd on
6.配置pureftpd_php_manager
cd /tmp
tar zvxf pureftpd_php_manager.tar.gz
cd pureftpd_php_manager
mv pureftpd-mysql.conf.sample /usr/local/etc/pureftpd-mysql.conf
cd ..
cp -R pureftpd_php_manager /var/www/html/pureftpd_php_manager
cd /var/www/html/pureftpd_php_manager
vi pureftp.config.php
按照你的需要修改里面的设置代码:
<?php
######################
####### SETUP ########
######################
// Your exactly located mysql config file for pureftpd
$PUREFTP_CONFIG_FILE = '/usr/local/etc/pureftpd-mysql.conf'
// The location where all the Forms directed to. (Mayby no change needed)
$SELF_URL = 'index.php'
// The location of your pure-ftpdwho binary (set this to chmod 4711)
$FTP_WHO = "/usr/local/pureftpd/sbin/pure-ftpwho";
#######################
# DEFAULT NEW-USER PARAMS #
#######################
$DefaultUser = ""; # Default User Logon
$DefaultPass = ""; # Default User Password
$DefaultUid = ""; # Default User ID ( must be a real user acct )
$DefaultGid = "2000"; # Default Group ID ( must be a real group acct )
$DefaultDir = "/home"; # Default User Dir ( use /./ at the end to chroot )
$DefaultUL = "0"; # Default Upload Throttle ( 0 disables it )
$DefaultDL = "0"; # Default Download Throttle ( 0 disables it )
$Defaultip = "*"; # Default IP restrictions ( * = any IP )
$DefaultQS = "50"; # Default Quota Size ( 0 disables it )
$Defaultcmt = ""; # Default Comment for user
// UA
$DefaultQF = "0"; # Default Quota Files ( 0 disables it )
$PWC = "55"; # Vorsatz fuerr Crypt Password
?>
增加用户组及用户
#groupadd ftpusers -g 2000
#useradd ftp -u 2000 -g ftpusers -s /sbin/nologin
删除多余的东西
rm -f history.txt pureftpd-mysql.conf.sample
如果要投入真实的使用,最好用apache做身份验证!
因为我们是放到网上执行的﹐所以你肯定不想每个人都跑去看你FTP用户吧﹗
我一般采用HTPASSWD验证﹐具体请这样子做﹐仍用我前面的例子﹕
我的pureftpd_php_manager目录位于 /var/www/html/pureftpd_php_manager目录﹐
修改httpd.conf在apache的虚拟主机那一小节添加如下内容﹕
<Directory "/var/www/html/pureftpd_php_manager">
deny from all
Options None
AllowOverride AuthConfig
Order deny,allow
</Directory>
这样﹐若有人想进入该目录﹐必须通过apache验证﹐保证我们的安全(不是绝对安全)
cd /var/www/html/pureftpd_php_manager
再进入pureftpd_php_manager的目录﹐使用vi建立一个.htaccess的认证文件﹕
vi .htaccess
内容如下﹕
AuthType Basic
AuthUserFile /usr/local/apache2/bin/pureftpd.passwd
AuthName pureftpd
require valid-user
satisfy any
存盘退出后﹐我们就可以使用htpasswd命令添加允许进入的该目录的用户了﹗
cd /usr/local/apache2/bin/
进入该目录
./htpasswd -bc pureftpd.passwd ftp 123456
这样将会在你的当前目录﹐创建一个pureftpd.passwd的身份验证文件﹐用户名是ftp﹐密码是123654﹐你可以
改为你自己需要。
http://你的ip/phpmyadmin/ 用户名:root 密码:123456
新建一个用户
用户名为pureftpd
密码为123456
再次登录http://你的ip/phpmyadmin/ 用户名:pureftpd 密码:123456
新建一个pureftpd数据库
在数据库pureftpd运行SQL查询 --内容如下:
DROP TABLE IF EXISTS ftpd;
CREATE TABLE ftpd (
User varchar(16) NOT NULL default '',
status enum(Ɔ',Ƈ') NOT NULL default Ɔ',
Password varchar(64) NOT NULL default '',
Uid varchar(11) NOT NULL default '-1',
Gid varchar(11) NOT NULL default '-1',
Dir varchar(128) NOT NULL default '',
ULBandwidth smallint(5) NOT NULL default Ɔ',
DLBandwidth smallint(5) NOT NULL default Ɔ',
comment tinytext NOT NULL,
ipaccess varchar(15) NOT NULL default '*',
QuotaSize smallint(5) NOT NULL default Ɔ',
QuotaFiles int(11) NOT NULL default 0,
PRIMARY KEY (User),
UNIQUE KEY User (User)
) TYPE=MyISAM;
编辑/usr/local/etc/pureftpd-mysql.conf
vi /usr/local/etc/pureftpd-mysql.conf
# If you want to use the Socket connect methode comment out the
# Lines with MMYSQLServer and MYSQLPort.
# If you want to use the Port methode comment out the MYSQLSocket line
MYSQLSocket /tmp/mysql.sock
MYSQLServer localhost
MYSQLPort 3306
MYSQLUser pureftpd (数据库用户名)
MYSQLPassword 123456 (数据库用户的密码)
MYSQLDatabase pureftpd (FTP数据数据库)
MYSQLCrypt cleartext (密码加密方式"cleartext", "crypt", "md5" and "password" cleartext 明文,crypt,md5,password是Backend password(『your-passwd』)函数(MYSQL数据库所使用的 )
MYSQLGetPW SELECT Password FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MYSQLGetUID SELECT Uid FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MYSQLGetGID SELECT Gid FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MYSQLGetDir SELECT Dir FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MySQLGetBandwidthUL SELECT ULBandwidth FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MySQLGetBandwidthDL SELECT DLBandwidth FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MySQLGetQTASZ SELECT QuotaSize FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MySQLGetQTAFS SELECT QuotaFiles FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
手动启动pureftpd
#/usr/local/sbin/pure-config.pl /usr/local/etc/pure-ftpd.conf
http://你的ip/pureftpd_php_manager/index.php
用户名: ftp
密 码 : 123456
新建一个ftp用户
点击ADD USR
Status Active (激活状态)
Username test (ftp用户名)
Password 888888 (ftp用户密码)
UID 2001 (用户ID)
GID 2000 (组ID)
DIR /home/test (ftp用户根目录)
UL Throttle kb/s 0 (上传带宽,0为不限制)
DL Throttle kb/s 0 (下载带宽,0为不限制)
IP ACCESS * (ip访问,*所有IP)
QuotaSize in MB 50 (限制空间)
QuotaFiles Anzahl 0 (限制文件个数,0为不限制)
COMMENT .....
别忘了Save
好了,在客户端测试一下吧!
转载自
http://www.chinalinuxpub.com/b....php?t=41042