CentOS 6.5 x86_64 安装Pure-Ftp + web管理pureadmin0.3
本文参考:http://wnqcmq.blog.51cto.com/5200614/1197629
软件环境:
pure-ftpd-1.0.36.tar.gz(pure-ftp)
PureAdmin-0.3.tar.gz(web管理)
pureftp.sql(虚拟账号的数据库导入文件)
pureftpd-mysql.conf(虚拟账号链接数据库的配置文件)
一.安装Pure-ftp server
# wget http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz
# tar -zxvf pure-ftpd-1.0.36.tar.gz -C /usr/local/src/
# cd /usr/local/src/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
# make && make install
拷贝生成pureftp服务的主配置文件和服务脚本:
# chmod a+x configuration-file/pure-config.pl
# cp configuration-file/pure-config.pl /usr/local/pureftpd/sbin/
# mkdir /usr/local/pureftpd/etc
# cp configuration-file/pure-ftpd.conf /usr/local/pureftpd/etc/
拷贝生成pureftp服务的启动脚本,并编辑修改相应参数:
# cp contrib/redhat.init /etc/init.d/pureftpd
# vim /etc/init.d/pureftpd
# chmod 755 /etc/init.d/pureftpd
# chkconfig --add pureftpd
# chkconfig pureftpd on
配置pure-ftp的主配置文件,添加虚拟账号的登录环境参数:
# vim /usr/local/pureftpd/etc/pure-ftpd.conf
创建用户的家目录:
# mkdir /data/resources/ftpdata
# chmod -R 777 /data/resources/ftpdata/
创建虚拟账号登录时映射的服务器本地nologin账号:
# useradd virtualftp -d /data/resources/ftpdata/ -s /sbin/nologin -M
# chown virtualftp.virtualftp /data/resources/ftpdata/
虚拟账号的认证配置:
# vim /usr/local/pureftpd/etc/pure-ftpd.conf
建立虚拟账号与服务器本地账号的映射:
# cd /usr/local/pureftpd/bin/
# ./pure-pw useradd user1 -u virtualftp -g virtualftp -d /data/resources/ftpdata/user1 -m
建立用户数据库:
# ./pure-pw mkdb /usr/local/pureftpd/pureftpf.pdb
二、安装PureAdmin web管理
点我下载:PureAdmin-0.3.tar.gz
# tar -zxvf PureAdmin-0.3.tar.gz
# mv PureAdmin-0.3 /var/www/html/pureadmin
INSERT INTO mysql.user (Host, User, Password, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv, Index_priv, Alter_priv,ssl_cipher,x509_issuer,x509_subject) VALUES('localhost','ftp',PASSWORD('passwd'),'Y','Y','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Y','Y'); FLUSH PRIVILEGES; CREATE DATABASE ftpusers; USE ftpusers; CREATE TABLE admin ( Username varchar(35) NOT NULL default '', Password char(32) binary NOT NULL default '', PRIMARY KEY (Username) ) ; INSERT INTO admin VALUES ('admin',MD5('123456')); CREATE TABLE `users` ( `User` varchar(16) NOT NULL default '', `Password` varchar(32) binary NOT NULL default '', `Uid` int(11) NOT NULL default '14', `Gid` int(11) NOT NULL default '5', `Dir` varchar(128) NOT NULL default '', `QuotaFiles` int(10) NOT NULL default '500', `QuotaSize` int(10) NOT NULL default '30', `ULBandwidth` int(10) NOT NULL default '80', `DLBandwidth` int(10) NOT NULL default '80', `Ipaddress` varchar(15) NOT NULL default '*', `Comment` tinytext, `Status` enum('0','1') NOT NULL default '1', `ULRatio` smallint(5) NOT NULL default '1', `DLRatio` smallint(5) NOT NULL default '1', PRIMARY KEY (`User`), UNIQUE KEY `User` (`User`) ) ;
导入数据,并授权:
# /etc/init.d/mysqld start
# mysql -rroot -p < pureftp.sql
mysql>grant all privileges on ftpusers.* to ftp@localhost identified by 'tmppasswd';
mysql> flush privileges;
mysql> quit
修改pureadmin的配置文件,修改数据库的相关参数:
# vim /var/www/html/pureadmin/config.php
配置pureftpd-mysql.conf连接数据库文件:
# cp /usr/local/src/pure-ftpd-1.0.36/pureftpd-mysql.conf /usr/local/pureftpd/etc/
# vim /usr/local/pureftpd/etc/pureftpd-mysql.conf
三、浏览器登录测试
http://10.163.11.252/pureadmin (用户名:admin,密码:123456)
遇到的错误:
报错:configure: error: PAM headers not found.
安装 yum install pam-devel
报错:configure: error: libmysqlclient is needed for MySQL support
安装mysql:yum -y install mysql-server mysql-devel mysql
共有 0 条评论