搭建lamp環境php
[root@111 ~]# yum install -y httpd php php-mysql mysql-server mysql-devel mysqlhtml
[root@111 ~]# service httpd restartmysql
Stopping httpd: [ OK ]ios
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 0.0.0.111 for ServerNameweb
[ OK ]sql
[root@111 ~]# vim /etc/resolv.conf 數據庫
[root@111 ~]# vim /etc/sysconfig/networkvim
[root@111 ~]# tar -zxvf pure-ftpd-1.0.36.tar.gz -C /usr/local/src/服務器
[root@111 ~]# cd /usr/local/src/pure-ftpd-1.0.36/cookie
[root@111 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-throtting \
> --with-language=simplified-chinese
[root@111 pure-ftpd-1.0.36]# make && make install
yum install httpd php php-mysql mysql mysql-server mysql-server
[root@donghao244 pure-ftpd-1.0.36]# cd /usr/local/pureftpd/
[root@donghao244 pureftpd]# ll
total 12
drwxr-xr-x 2 root root 4096 Aug 4 17:46 bin
drwxr-xr-x 2 root root 4096 Aug 4 17:46 sbin
drwxr-xr-x 3 root root 4096 Aug 4 17:46 share
[root@111 pureftpd]# pwd
/usr/local/pureftpd
[root@111 pureftpd]# mkdir etc
[root@111 pure-ftpd-1.0.36]# cd configuration-file/
[root@111 configuration-file]# cd /usr/src/pure-ftpd-1.0.36/
//服務的控制腳本
[root@111 configuration-file]# cp pure-ftpd.conf /usr/local/pureftpd/etc/
[root@111 configuration-file]# chmod 755 pure-config.pl
服務啓動時調用的控制腳本
[root@111 configuration-file]# cp pure-config.pl /usr/local/pureftpd/sbin/
[root@111 contrib]# pwd
/usr/src/pure-ftpd-1.0.36/contrib
[root@111 contrib]# cp redhat.init /etc/init.d/pureftpd
[root@111 contrib]# chmod 755 /etc/init.d/pureftpd
[root@111 contrib]# ll /etc/init.d/pureftpd
-rwxr-xr-x 1 root root 1178 Aug 7 19:15 /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@111 contrib]# service pureftpd restart
Stopping pure-config.pl: cat: /var/run/pure-ftpd.pid: No such file or directory
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
Starting 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
//pureftp 已經能夠正常啓動
[root@111 contrib]# chkconfig --add pureftpd
[root@111 contrib]# chkconfig --list |grep pureftpd
Pureftpd 0: off 1:off 2:on 3:on 4:on 5 :on 6 :off
[root@111 contrib]# mkdir /ftproot
[root@111 contrib]# useradd vtftp -d /ftproot -s /sbin/nologin -M
[root@111 contrib]# chown vtftp.vtftp /ftproot/
[root@111 contrib]# ll -d /ftproot/
drwxrwxrwx 2 vtftp vtftp 4096 Aug 7 19:26 /ftproot/
修改主配置文檔
[root@111 contrib]# vim /usr/local/pureftpd/etc/pure-ftpd.conf
77 NoAnonymous yes //不容許匿名
336 CreateHomeDir yes //生成家目錄
調度數據庫中的數據進行驗證
[root@111 contrib]# vim /usr/local/pureftpd/etc/pure-ftpd.conf
116 MySQLConfigFile /usr/local/pureftpd/etc/pureftpd-mysql.conf
[root@111 ~]# cp pureftp/pureftpd-mysql.conf /usr/local/pureftpd/etc/
27 MYSQLUser ftp //訪問數據庫的身份
32 MYSQLPassword tmppasswd
37 MYSQLDatabase ftpusers
45 MYSQLCrypt md5
//後臺管理的帳號
50 INSERT INTO admin VALUES ('admin',MD5('123'));
//導入數據
Mysql -u root -p < pureftp.sql
[root@111 pureftp]# mysql -u root -p <pureftp.sql
Enter password:123
[root@111 pureftp]# //成功導入數據
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)
[root@111 pureftp]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databasess;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'databasess' at line 1
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| extmail |
| ftpusers |
| mysql |
| test |
+--------------------+
5 rows in set (0.11 sec)
管理頁面
[root@111 pureftp]# tar -zxvf PureAdmin-0.3.tar.gz -C /var/www/html/
[root@111 pureftp]# cd /var/www/html/
[root@111 html]# mv PureAdmin-0.3 pureadmin
[root@111 html]# cd pureadmin/
[root@111 pureadmin]# vim config.php
3 $cfg['dbname']='ftpusers'; //mysql db name
4 $cfg['dbuser']='ftp'; //mysql user
5 $cfg['dbpasswd']='temppasswd'; //mysql password
10 $cfg['passwdtype']='MD5';
14 $cfg['dir']='/ftproot/'; //dir
[root@111 configuration-file]# mkdir /ftproot
[root@111 configuration-file]# chmod -R 777 /ftproot
[root@111 configuration-file]# useradd vtftp -d /ftproot -s /sbin/nologin -M
[root@111 configuration-file]# vim /usr/local/pureftpd/etc/pure-ftpd.conf
336 CreateHomeDir yes
116 MySQLConfigFile /etc/pureftpd-mysql.conf
116 MySQLConfigFile /usr/local/pureftpd/etc/pureftpd-mysql.conf
[root@111 configuration-file]# service pureftpd restart
Stopping pure-config.pl:
Starting 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 -j -k99 -Z
[root@111 configuration-file]# cp /root/pureftp/pureftpd-mysql.conf /usr/local/pureftpd/etc/
[root@111 configuration-file]# vim /usr/local/pureftpd/etc/pureftpd-mysql.conf
32 MYSQLPassword tmppasswd
27 MYSQLUser ftp
45 MYSQLCrypt md5
[root@111 configuration-file]# cd /root/pureftp/
[root@111 pureftp]# vim pureftp.sql
50 INSERT INTO admin VALUES ('admin',MD5('123'));
[root@111 pureftp]# mysql -u root -p <pureftp.sql
Enter password:
[root@111 pureftp]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 22
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| extmail |
| ftpusers |
| mysql |
| test |
+--------------------+
5 rows in set (0.00 sec)
mysql> select * from admin;
+----------+----------------------------------+
| Username | Password |
+----------+----------------------------------+
| admin | 202cb962ac59075b964b07152d234b70 |
+----------+----------------------------------+
1 row in set (0.00 sec)
mysql> \q
[root@111 pureftp]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 24
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> grant all privileges on ftpusers.* to ftp@localhost identified by 'tmppasswd';
Query OK, 0 rows affected (0.03 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
[root@111 pureftp]# tar -zxvf /root/pureftp/PureAdmin-0.3.tar.gz -C /var/www/html/
[root@111 pureftp]# cd /var/www/html/
[root@111 html]# mv PureAdmin-0.3/ pureadmin
[root@111 html]# cd pureadmin/
[root@111 pureadmin]# vim config.php
3 $cfg['dbname']='ftpusers'; //mysql db name
4 $cfg['dbuser']='ftp'; //mysql user
5 $cfg['dbpasswd']='tmppasswd'; //mysql password
9 //ftp passwd type : TEXT/CRYPT/MD5
10 $cfg['passwdtype']='MD5';
14 $cfg['dir']='/ftproot/'; //dir
[root@111 pureadmin]# vim config.php
1 <?php
2 $cfg['dbhost']='localhost'; //mysql host
3 $cfg['dbname']='ftpusers'; //mysql db name
4 $cfg['dbuser']='ftp'; //mysql user
5 $cfg['dbpasswd']='tmppasswd'; //mysql password
7 //ftp config
8 $cfg['page']=15;
9 //ftp passwd type : TEXT/CRYPT/MD5
10 $cfg['passwdtype']='MD5';
11 //ftp default
12 $cfg['uid']=1000; //uid
13 $cfg['gid']=1000; //gid
14 $cfg['dir']='/ftproot/'; //dir
15 $cfg['qf']=0; //quotafiles
16 $cfg['qs']=100; //quotasize
17 $cfg['ul']=100; //ULBandwidth
18 $cfg['dl']=200; //DLBandwidth
19 $cfg['ur']=0; //ULRatio
20 $cfg['dr']=0; //DLRatio
21 $cfg['status']=1; //status
22 $cfg['ip']= '*'; //ipaddress
23 ?>
從新啓動pureftp服務
使用web方式管理ftp服務器
此時能夠使用pureftpadm經過web方式管理ftp服務