安装相应软件:
编辑本地yum:
[root@localhost ~]# mkdir /mnt/cdrom
[root@localhost ~]# mount /dev/cdrom /mnt/cdrom
[root@localhost ~]# cd /mnt/cdrom/Server
[root@localhost Server]# vim /etc/yum.repos.d/rhel-debuginfo.repo
编辑结果:
[rhel-server]name=Red Hat Enterprise Linux Serverbaseurl=file:///mnt/cdrom/Server
enabled=1
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
[root@localhost Server]# yum -y install httpd php php-mysql mysql mysql-server mysql-devel
启动相关服务:
[root@localhost ~]# service httpd start
启动 httpd: [确定]
[root@localhost ~]# chkconfig httpd on
[root@localhost ~]# service mysqld start
[root@localhost ~]# chkconfig mysqld on
设置mysql管理员账号:
[root@localhost ~]# mysqladmin -u root -p password '123'
将相关软件复制到根目录下:
[root@localhost ~]# ll
总计 64
-rw------- 1 root root 1176 2012-08-03 anaconda-ks.cfg
drwxr-xr-x 2 root root 4096 08-02 20:16 Desktop
-rw-r--r-- 1 root root 35236 2012-08-03 install.log
-rw-r--r-- 1 root root 3995 2012-08-03 install.log.syslog
drwxr-xr-x 2 root root 4096 08-02 20:56 pureftp
[root@localhost ~]# cd pureftp/
[root@localhost pureftp]# ll
总计 10804
-rw-r--r-- 1 root root 29148 08-02 20:56 PureAdmin-0.3.tar.gz
-rw-r--r-- 1 root root 578781 08-02 20:56 pure-ftpd-1.0.36.tar.gz
-rw-r--r-- 1 root root 4718 08-02 20:56 pureftpd-mysql.conf
-rw-r--r-- 1 root root 2105 08-02 20:56 pureftp.sql
-rw-r--r-- 1 root root 196917 08-02 20:56 webpureftp0.1.tar.gz
-rw-r--r-- 1 root root 10208541 08-02 20:56 ZendOptimizer-3.3.3-linux-hicode.tar.gz
//pureftp.sql下载地址:http://down.51cto.com/data/513798
//pureftpd-mysql.conf下载地址:http://down.51cto.com/data/513799
源码安装pureftpd:
[root@localhost pureftp]# tar -zxvf pure-ftpd-1.0.36.tar.gz
-C /usr/local/src
[root@localhost pureftp]# cd /usr/local/src/pure-ftpd-1.0.36/
[root@localhost pure-ftpd-1.0.36]# ./configure \
> --prefix=/usr/local/pureftpd \
> --with-mysql \
> --with-shadow \
> --with-pam \
> --with-welcomemsg \
> --with-uploadscript \
> --with-cookie \
> --with-virtualchroot \
> --with-virtualhosts \
> --with-diraliases \
> --with-quotas \
> --with-puredb \
> --with-sysquotas \
> --with-ratios \
> --with-ftpwho \
> --with-throttling \
> --with-language=simplified-chinese
[root@localhost pure-ftpd-1.0.36]# make
[root@localhost pure-ftpd-1.0.36]# make install
生成pure-ftpd的服务脚本:
[root@localhost pure-ftpd-1.0.36]# mkdir /usr/local/pureftpd/etc
[root@localhost pure-ftpd-1.0.36]# cd configuration-file/
[root@localhost configuration-file]# cp pure-ftpd.conf /usr/local/pureftpd/etc
[root@localhost configuration-file]# chmod 755 pure-config.pl
[root@localhost configuration-file]# cp pure-config.pl /usr/local/pureftpd/sbin
生成pure-ftpd的服务:
[root@localhost configuration-file]# cd ..
[root@localhost pure-ftpd-1.0.36]# cd contrib/
[root@localhost contrib]# cp redhat.init /etc/init.d/pureftpd
[root@localhost contrib]# chmod 755 /etc/init.d/pureftpd
[root@localhost contrib]# vim /etc/init.d/pureftpd
编辑结果:
18 fullpath=/usr/local/pureftpd/sbin/$prog
19 pureftpwho=/usr/local/pureftpd/sbin/pure-ftpwho
24 $fullpath /usr/local/pureftpd/etc/pure-ftpd.conf –daemonize
[root@localhost contrib]# service pureftpd start
启动 pure-config.pl:Running: /usr/local/pureftpd/sbin/pure-ftpd --daemonize -A -c50 -B -C8 -D -fftp -H -I15 -L10000:8 -m4 -s -U133:022 -u100 -k99 -Z
[root@localhost contrib]# chkconfig --add pureftpd
[root@localhost contrib]# chkconfig pureftpd on
配置虚拟用户登录环境:
[root@localhost contrib]# mkdir /ftproot
[root@localhost contrib]# chmod -R 777 /ftproot
[root@localhost contrib]# useradd virtualftp -d /ftproot -s /sbin/nologin -M
[root@localhost contrib]# vim /usr/local/pureftpd/etc/pure-ftpd.conf
编辑结果:
77 NoAnonymous yes
336 CreateHomeDir yes
[root@localhost contrib]# service pureftpd restart
停止 pure-config.pl:
启动 pure-config.pl:Running: /usr/local/pureftpd/sbin/pure-ftpd --daemonize -A -c50 -B -C8 -D -E -fftp -H -I15 -L10000:8 -m4 -s -U133:022 -u100 -j -k99 -Z
用mysql认证:
[root@localhost contrib]# vim /usr/local/pureftpd/etc/pure-ftpd.conf
编辑结果:
116 MySQLConfigFile /usr/local/pureftpd/etc/pureftpd-mysql .conf
[root@localhost contrib]# cd
[root@localhost ~]# cd pureftp/
[root@localhost pureftp]# cp pureftpd-mysql.conf /usr/local/pureftpd/etc
[root@localhost pureftp]# cd /usr/local/pureftpd/etc
[root@localhost etc]# vim pureftpd-mysql.conf
编辑结果:
32 MYSQLPassword tmppasswd
45 MYSQLCrypt md5
[root@localhost etc]# cd
[root@localhost ~]# cd pureftp/
[root@localhost pureftp]# vim pureftp.sql
编辑结果:
-- -------------------------------------------------------
INSERT INTO admin VALUES ('admin',MD5('123'));
[root@localhost pureftp]# mysql -u root -p < pureftp.sql
Enter password:
[root@localhost pureftp]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.77 Source distribution
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| ftpusers |
| mysql |
| test |
+--------------------+
mysql> use ftpusers;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+--------------------+
| Tables_in_ftpusers |
+--------------------+
| admin |
| users |
+--------------------+
2 rows in set (0.00 sec)
mysql> select * from admin;
+----------+----------------------------------+
| Username | Password |
+----------+----------------------------------+
| admin | 202cb962ac59075b964b07152d234b70 |
+----------+----------------------------------+
1 row in set (0.00 sec)
mysql> grant all privileges on ftpusers.* to ftp@localhost identified by 'tmppasswd';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit;
Bye
安装并配置pureadmin:
[root@localhost pureftp]# tar -zxvf PureAdmin-0.3.tar.gz –C /var/www/html
[root@localhost pureftp]# cd /var/www/html
[root@localhost html]# mv PureAdmin-0.3 pureadmin
[root@localhost html]# cd pureadmin
[root@localhost pureadmin]# vim config.php
编辑结果:
3 $cfg['dbname']='ftpusers'; //mysql db name
4 $cfg['dbuser']='ftp'; //mysql user
5 $cfg['dbpasswd']='tmppasswd'; //mysql password
10 $cfg['passwdtype']='MD5';
14 $cfg['dir']='/ftproot/'; //dir
18 $cfg['dl']=200; //DLBandwidth
用pureDB认证:
[root@localhost pureadmin]# cd /ftproot/
[root@localhost ftproot]# vim /usr/local/pureftpd/etc/pure-ftpd.conf
编辑结果:
PureDB /usr/local/pureftpd/pureftpd.pdb
[root@localhost ftproot]# cd /usr/local/pureftpd
[root@localhost pureftpd]# echo PATH=$PATH:/usr/local/pureftpd/bin >>/etc/profile
[root@localhost pureftpd]# . /etc/profile
[root@localhost pureftpd]# cd
[root@localhost ~]# pure-pw useradd user1 -u virtualftp -g virtualftp -d /ftproot/user1 -m
Password:
Enter it again:
建立用户数据库:
[root@localhost ~]# pure-pw mkdb /usr/local/pureftpd/pureftpd.pdb
[root@localhost ~]# service httpd restart
停止 httpd: [确定]
启动 httpd: [确定]
[root@localhost ~]# service pureftpd restart
停止 pure-config.pl:
启动 pure-config.pl:Running: /usr/local/pureftpd/sbin/pure-ftpd --daemonize -A -c50 -B -C8 -D -E -fftp -H -I15 -lmysql:/usr/local/pureftpd/etc/pureftpd-mysql.conf -L10000:8 -m4 -s -U133:022 -u100 -j -k99 –Z
转载于:https://blog.51cto.com/caoruijun/997992