#########################
#pure-ftpd+mysql+pma#
#Author: cheng #
#Date: 2009-3-11 #
#Env: Centos 5.2 x86_64 #
#########################
#http://www.chengyongxu.com/blog-en/pure-ftpdmysqlpma/
I.Preparations:
System environment:Centos 5.2 x86_64
The necessary software:
mysql-5.1.32-linux-x86_64-icc-glibc23.tar.gz
pure-ftpd-1.0.21.tar.gz
phpMyAdmin-3.1.3-all-languages.tar.gz
####################################
Download this software
cd /usr/local/src
wget http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.21.tar.gz
The following two software uploaded to the server after downloading
#http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.32-linux-x86_64-icc-glibc23.tar.gz/from/pick#mirrors
mysql-5.1.32-linux-x86_64-icc-glibc23.tar.gz
#http://www.phpmyadmin.net/home_page/index.php
phpMyAdmin-3.1.3-all-languages.tar.gz
####################################
II.Setup
(1)MySQL installation
#If there is already a web + php + mysql environment, skip this step please
cd /usr/local/src
tar zxvf mysql-5.1.32-linux-x86_64-icc-glibc23.tar.gz
mv mysql-5.1.32-linux-x86_64-icc-glibc23 /usr/local/
ln -s /usr/local/mysql-5.1.32-linux-x86_64-icc-glibc23 /usr/local/mysql
useradd mysql -M
chown -R mysql:root /usr/local/mysql/
cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf
vi /etc/my.cnf
—————– warning ——————-
datadir=/var/lib/mysql
————————————————
cd /usr/local/mysql
./scripts/mysql_install_db --user=mysql
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 3 mysqld on
chown -R mysql:mysql /var/lib/mysql
cd /usr/local/mysql/bin
for i in *; do ln -s /usr/local/mysql/bin/$i /usr/bin/$i; done
(2)pure-ftpd installation
#If skip this step, you will receive an error message when configure
#error: Your MySQL client libraries aren't properly installed
echo “/usr/local/mysql/lib/” >> /etc/ld.so.conf && ldconfig
cd /usr/local/src && tar xvf pure-ftpd-1.0.21.tar.gz && cd pure-ftpd-1.0.21
./configure --prefix=/usr/local/pureftpd --with-mysql --with-mysql-lib-dir=/usr/local/mysql --with-paranoidmsg --with-uploadscript --with-cookie --with-virtualchroot --with-virtualhosts --with-virtualroot --with-diraliases --with-quotas --with-sysquotas --with-ratios --with-ftpwho --with-throttling --with-puredb --with-shadow --with-pam --with-peruserlimits --with-altlog --with-iplogging --with-largefile
make && make install
make install-strip
(3)Add users and groups
#If you skip this step,you will receive an error message:"530 login authentication failed" later
groupadd ftpgroup
useradd ftpuser -g ftpgroup -d /www/wwwroot/ -s /sbin/nologin
chown -R ftpuser:ftpgroup /www/wwwroot
(3)configuration
mkdir /usr/local/pureftpd/etc
cp configuration-file/pure-ftpd.conf !$/
cp pureftpd-mysql.conf /usr/local/pureftpd/etc/
vi /usr/local/pureftpd/etc/pure-ftpd.conf
#Change these options
##########################################
65c65
DisplayDotFiles yes —> DisplayDotFiles no
77c77
NoAnonymous no —> NoAnonymous yes
116c116
# MySQLConfigFile /etc/pureftpd-mysql.conf —> MySQLConfigFile /usr/local/pureftpd/etc/pureftpd-mysql.conf
246c246
AllowUserFXP no —> AllowUserFXP yes
324c324
#NoChmod yes —> NoChmod yes
336c336
#CreateHomeDir yes —> CreateHomeDir yes
429c429
# IPV4Only yes —> IPV4Only yes
##########################################
vi /usr/local/pureftpd/etc/pureftpd-mysql.conf
#Change these options
##########################################
27c27
MYSQLUser root—> MYSQLUser pureftpd
32c32
MYSQLPassword rootpw —> MYSQLPassword (yourpasswd)
45c45
MYSQLCrypt cleartext —> MYSQLCrypt md5
##########################################
(4)Start
cp configuration-file/pure-config.pl /usr/local/pureftpd/sbin/
chmod 755 /usr/local/pureftpd/sbin/pure-config.pl
cp contrib/redhat.init /etc/init.d/pureftpd
chmod 755 /etc/init.d/pureftpd
chkconfig --add pureftpd
chkconfig --level 3 pureftpd on
#Edit /etc/init.d/pureftpd,Change the actual situation in accordance with the relevant path
vi /etc/init.d/pureftpd
#—————————-Quoted text - start—————————-
#!/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: /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/pureftpd/sbin/$prog
pureftpwho=/usr/local/pureftpd/sbin/pure-ftpwho
start() {
echo -n $”Starting $prog: ”
$fullpath /usr/local/pureftpd/etc/pure-ftpd.conf --daemonize
RETVAL=$?
[ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
echo
}
stop() {
echo -n $”Stopping $prog: ”
kill $(cat /var/run/pure-ftpd.pid)
RETVAL=$?
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog
echo
}
# See how we were called.
case “$1″ in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/lock/subsys/$prog ] ; then
stop
# avoid race
sleep 3
start
fi
;;
status)
status $prog
RETVAL=$?
if [ -f $pureftpwho ] && [ $RETVAL -eq 0 ] ; then
$pureftpwho
fi
;;
*)
echo $”Usage: $prog {start|stop|restart|condrestart|status}”
RETVAL=1
esac
exit $RETVAL
#—————————-Quoted text - end—————————-
(5)MySQL authenticate
mysql -p
mysql> create database pureftpd;
mysql> grant all on pureftpd.* to pureftpd@localhost identified by ‘yourpasswd’ with grant option;
mysql> use pureftpd;
mysql> CREATE TABLE IF NOT EXISTS `users` ( `id` int(11) NOT NULL auto_increment, `user` varchar(16) NOT NULL, `password` varchar(64) NOT NULL, `uid` varchar(11) NOT NULL, `gid` varchar(11) NOT NULL, `dir` varchar(128) NOT NULL, `quotasize` varchar(5) NOT NULL, `quotafiles` varchar(11) NOT NULL, `ulbandwidth` varchar(5) NOT NULL, `dlbandwidth` varchar(5) NOT NULL, `ulratio` varchar(6) NOT NULL, `dlratio` varchar(6) NOT NULL, `comment` tinytext NOT NULL, `ipaccess` varchar(15) NOT NULL, `status` enum(’0′,’1′) default NULL, `create_date` datetime NOT NULL, `modify_date` datetime NOT NULL, PRIMARY KEY (`id`,`user`) ) ENGINE=MyISAM DEFAULT CHARSET=gbk AUTO_INCREMENT=1;
(6)Use pma manage pureftpd
cd /www/wwwroot/
tar xvf /usr/local/src/phpMyAdmin-3.?.?-all-languages.tar.gz
#Use a complex directory name,I present here a simple
mv phpMyAdmin* pma
cd pma && mv config.sample.inc.php config.inc.php
#change the authentication information
vi config.inc.php
#login
http://yoursite/pma
#Add the user remember the password when the data type and you want to pureftpd-mysql.conf settings in the same MYSQLCrypt, I set up the md5
(7)Start service and have a test
service pureftpd start
ftp 127.0.0.1
#—————————-Quoted text - start—————————-
Connected to 127.0.0.1.
220---------- Welcome to Pure-FTPd ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 17:49. Server port: 21.
220-This is a private system - No anonymous login
220 You will be disconnected after 15 minutes of inactivity.
500 This security scheme is not implemented
500 This security scheme is not implemented
KERBEROS_V4 rejected as an authentication type
Name (127.0.0.1:root): test1
331 User test1 OK. Password required
Password:
230-User test1 has group access to: 502
230-This server supports FXP transfers
230 OK. Current restricted directory is /
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (127,0,0,1,242,219)
150 Accepted data connection
drwxr-xr-x 3 501 501 4096 Jan 16 23:10 wwwroot
226-Options: -l
226 1 matches total
ftp>
#—————————-Quoted text - end—————————-
#Completed