ftpserver: 内网:172.150.84.143 公网ip:112.113.114.115
1.安装apache,php,mysql-client包,并准备映射的用户
- yum -y install apache,php,mysql,mysql-devel,php-mysql
启动apache
- service httpd start
建立映射用户
- mkdir -p /ftp/vuser
- useradd -d /ftp -s /sbin/nologin -u 3000 vuser ##只能下载的映射
- useradd -d /ftp -s /sbin/nologin -u 3001 vuser_upload ##也能上传的映射
- setfacl -m u:vuser:rx /ftp/vuser
- setfacl -m u:vuser_upload:rwx /ftp/vuser
2.下载编译安装pureftpd
- wget ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.bz2
- tar xvf pure-ftpd-1.0.36.tar.bz2
- cd pure-ftpd-1.0.36
- ./configure --prefix=/usr/local/pureftpd \
- --with-mysql --with-pam \
- --with-shadow --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
- make && make install
配置文件
- mkdir /usr/local/pureftpd/etc
- cp configuration-file/pure-ftpd.conf /usr/local/pureftpd/etc/
启动文件
- chmod +x configuration-file/pure-config.pl
- cp configuration-file/pure-config.pl /usr/local/pureftpd/sbin/
redhat脚本
- cp contrib/redhat.init /etc/init.d/pureftpd
- chmod +x /etc/init.d/pureftpd
- chkconfig --add pureftpd
- chkconfig pureftpd on
更改脚本符合要求
- vim /etc/init.d/pureftpd
- fullpath=/usr/local/pureftpd/sbin/$prog ##18 行
- pureftpwho=/usr/local/pureftpd/sbin/pure-ftpwho ##19 行
- $fullpath /usr/local/pureftpd/etc/pure-ftpd.conf --daemonize ##24行
启动pureftpd
- service pureftpd start
3.安装pureftp-user-manager
- wget http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz
- tar xvf ftp_v2.1.tar.gz
- cp -r ftp /var/www/html/ ##rpm安装的apache,目录在/var/www/html下
- cd /var/www/html/ftp
- chown apache config.php
编辑配置文件
- vim config.php
- $DBHost = "172.150.84.151" ##11行,mysqlserver的地址
- $DBLogin = "root" ##14行,mysqlserver的授权用户
- $DBPassword = "www.8ddy.com" ##16行,授权的密码,其它默认即可
浏览器访问http://112.113.114.115/ftp/install.php
傻瓜式安装
step1 检查环境
step2 新安装or升级安装step3 mysql账号密码step4 账号密码,数据库step5 修改default ID,default GID,支持quota,记的保存
step6 设置管理员账号密码 step7 根据提示修改 pureftpd 配置文件- vim /usr/local/pureftpd/etc/pure-ftpd.conf
- NoAnonymous yes ##禁止匿名
- MySQLConfigFile /usr/local/pureftpd/etc/pureftpd-mysql.conf #116行,关于mysql配置
- vim /usr/local/pureftpd/etc/pureftpd-mysql.conf
- ##将浏览器的拷贝进去
重启pureftpd
- service pureftpd restart
4.添加用户
访问http://112.113.114.115/ftp/index.php
建立文件测试
- echo "hello ftp" > /ftp/vuser/ftp.txt
浏览器访问:ftp://112.113.114.115/
下载,上传测试,到此建立完毕