免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12345下一页
最近访问板块 发新帖
查看: 32462 | 回复: 43
打印 上一主题 下一主题

[FreeBSD] 《FreeBSD新手快速入门》第5篇__FreeBSD服务器之FTP服务 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-11-29 13:28 |只看该作者 |倒序浏览
FreeBSD6.2架设之Pure-FTPd服务器

Pure-FTPd Server On FreeBSD6.2 HowTo

Mongolia



Index:
  • 简介
  • Step 1 installation Apache22.
  • Step 2 installation MySQL Server.
  • Step 3 installation PHP.
  • Step 4 installation PureFTPd.
  • Step 5 creating a MySQL database.
  • Step 6 configuration of PureFTPd.
  • Setp 7 User manager for PureFTPd.
  • F.A.Q.
  • Links to other sources
为方便离线查看,现附上PDF文档

[ 本帖最后由 freemongolia 于 2007-11-29 13:50 编辑 ]

Pure-FTPd Server On FreeBSD6.2 HowTo.pdf

193.23 KB, 下载次数: 934

论坛徽章:
0
2 [报告]
发表于 2007-11-29 13:28 |只看该作者

简介


Pure-FTPd is a free (BSD), secure, production-quality and standard-conformant FTP server. It doesn't provide useless bells and whistles, but focuses on efficiency and ease of use. It provides simple answers to common needs, plus unique useful features for personal users as well as hosting providers.

Pure-FTPd是一个自由的、安全的、高品质的FTP Server。它,高效并且易于使用。Pure-FTPd提供多语言支持,包括简体文、繁体中文,同时也支持UTF-8。本文使用FreeBSD6.2做为系统,使用Pure-FTPd程序提供FTP服务,并且结合MySQL Server做认证。支持虚拟用户、用户带宽控制、用户磁盘限额。使用User manager for PureFTPd,提供后台管理界面。
FreeBSD6.2+Apache22+PHP5+php5-extensions+ Pure-FTPd+ User manager for PureFTPd
软件版本信息:
·FreeBSD 6.2-RELEASE
·Apache-2.2.3
·Mysql-server-5.0.27
·Php5-5.1.6_3
·Php5-extensions-1.0
·Pure-FTPd-1.0.21_1
·User manager for Pure-FTPd

论坛徽章:
0
3 [报告]
发表于 2007-11-29 13:29 |只看该作者


Step 1 Installation Apache22.


Installation of the Apache server:
跟随下面步骤安装 Apache2.
使用Ports方式安装Apache22(更易于以后的维护,比如升级、卸载),进入Apache22所在的Ports安装目录/usr/ports/www/apache22目录,执行make install clean进行安装。
Shell:
whereis apache22
apache22: /usr/ports/www/apache22
cd /usr/ports/www/apache22
make install clean
系统要求选择模块,取消IPV6支持,其它保持默认即可

Options for apache 2.2.6_2
[ ]
IPV6
Enable IPv6 support
安装完成后,输入rehash命令刷新
Shell:
To run apache www server from startup, add apache22_enable="YES"
in your /etc/rc.conf. Extra options can be found in startup script.
===>
Cleaning for autoconf-wrapper-20071109

===>
Cleaning for p5-gettext-1.05_1

===>
Cleaning for apache-2.2.6_2

rehash
系统提示,需要添加apache22_enable=”YES”/etc/rc.conf文件。
(具体信息可以查看cat /usr/local/etc/rc.d/apache22会有详细说明)
Shell:
vi /etc/rc.conf
添加以下内容
Editor:
#Apache22
apache22_enable="YES"
保存退出后,启动Apache进行测试
输入命令/usr/local/etc/rc.d/apache22 start启动Apache
Shell:
/usr/local/etc/rc.d/apache22 start
Syntax OK
Starting apache22.

使用浏览器访问FreeBSD服务器IP地址测试Apache是否工作正常
浏览器打开http://youipaddress
It works!
好了,Apache22安装成功了。



[ 本帖最后由 freemongolia 于 2007-11-29 13:31 编辑 ]

论坛徽章:
0
4 [报告]
发表于 2007-11-29 13:32 |只看该作者

Step 2 Installation MySQL Server.


Installation of the MySQL server:
跟随下面步骤安装 MySQL.
使用Ports方式安装MySQL,进入MySQL所在的Ports安装目录/usr/ports/www/apache22目录,执行make install clean进行安装。
Shell:
whereis mysql50-server
mysql50-server: /usr/ports/databases/mysql50-server
cd /usr/ports/databases/mysql50-server/
make install clean
安装完成后,输入rehash命令刷新
Shell:
http://www.mysql.com/
===>
Cleaning for mysql-client-5.0.45_1

===>
Cleaning for mysql-server-5.0.45_1

rehash
系统提示,需要添加mysql_enable=”YES”/etc/rc.conf文件。
(具体信息可以查看cat /usr/local/etc/rc.d/mysql-server会有详细说明)
Shell:
vi /etc/rc.conf
添加以下内容
Editor:
#MySQL5.0
mysql_enable="YES"
保存退出后,启动Mysql5.0进行测试
输入命令/usr/local/etc/rc.d/mysql-server start启动Mysql

检测Mysql是否正常运行
可以通过监听端口和系统进程进行判断
Shell:
netstat -an | grep "3306"
tcp4 0 0 *.3306 *.* LISTEN
ps -aux|grep mysql|grep -v grep
mysql 97589 0.0 0.3 1728 1376 p0 I 3:03PM 0:00.09 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/va
mysql 97609 0.0 4.9 53844 25576 p0 S 3:03PM0:01.07 /usr/local/libexec/mysqld --defaults-extra-file=/var/db/mysq
系统显示Mysql已在所有地址(0)上监听3306端口,并且也可以查到Mysql的进程。

更改Mysql密码
Mysql安装完成后,并没有设定密码。为增加数据库安装性,使用mysqladmin命令设定Mysql密码
Shell:
mysqladmin -u root password '123456'  ('123456')是你要设定的密码
验证密码是否设定常
Shell:
mysql -u root -p
Enter password:
Welcome to the MySQL monitor.
Commands end with ; or \g.

Your MySQL connection id is 3
Server version: 5.0.45 FreeBSD port: mysql-server-5.0.45_1

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+--------------------+
| Database
|

+--------------------+
| information_schema |
| mysql
|

| test
|

+--------------------+
3 rows in set (0.01 sec)

mysql> quit
Bye
密码设定正确。至此Mysql安装完成。


[ 本帖最后由 freemongolia 于 2007-11-29 13:34 编辑 ]

论坛徽章:
0
5 [报告]
发表于 2007-11-29 13:34 |只看该作者

Step 3 Installation PHP5.


Installation of the PHP5:
跟随下面步骤安装 PHP5.
使用Ports方式安装PHP5,进入PHP5所在的Ports安装目录/usr/ports/www/php2执行ake install clean进行安装。
Shell:
whereis php5
php5: /usr/ports/lang/php5
cd /usr/ports/lang/php5/
make install clean

安装时,会要求进行php5选项设定,这里选择如下
Options for php5 5.2.5

[X]

APACHE

Build Apache module

[X]

MULTIBYTE

Enable zend multibyte support


安装完成后,输入rehash命令刷新
Shell:
***************************************************************
Make sure index.php is part of your DirectoryIndex.
You should add the following to your Apache configuration file:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
***************************************************************
===>
Cleaning for pkg-config-0.22_1

===>
Cleaning for libxml2-2.6.30

===>
Cleaning for php5-5.2.5

rehash
系统提示,需要添加以上被标记颜色到httpd.conf文件。
先备份httpd.conf文件
Shell:
cd /usr/local/etc/apache22/
cp httpd.conf httpd.conf.bak
编辑httpd.conf文件
Shell:
vi /usr/local/etc/apache22/httpd.conf
编辑/usr/local/etc/apache22/httpd.conf文件,以使Apache Server支持php

编辑/usr/local/etc/apache22/httpd.conf,在AddType application/x-gzip .gz .tgz(大约354)下面添加添加以下内容
Editor:
index.php
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

修改前:

# probably should define those extensions to indicate media types:

#

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz

修改后:

# probably should define those extensions to indicate media types:

#

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

先不要退出,添加'index.php' 'DirectoryIndex' 主目录索引(大约212)

Editor:

DirectoryIndex index.php index.html index.htm

修改前:

#

<IfModule dir_module>

DirectoryIndex index.html

</IfModule>


#

修改后:

#

<IfModule dir_module>

DirectoryIndex index.php index.html index.htm

</IfModule>

#
保存退出后。

[ 本帖最后由 freemongolia 于 2007-11-29 13:36 编辑 ]

论坛徽章:
0
6 [报告]
发表于 2007-11-29 13:37 |只看该作者

Installation of the PHP5-Extensions:
跟随下面步骤安装 PHP5-Extensions.
使用Ports方式安装PHP5-extensions,进入PHP5-extensions所在的Ports安装目录/usr/ports/lang/php5-extensions目录,执行make install clean进行安装。
Shell:
whereis php5-extensions
php5-extensions: /usr/ports/lang/php5-extensions
cd /usr/ports/lang/php5-extensions/
make install clean
安装时,会要求进行php5-extensions选项设定,这里选择如下
Options for php5-extensions 1.0
[X]
MYSQL
MySQL database support
[X]
PCRE
Perl Compatible Regular Expression support
[X]
POSIX
POSIX-like functions
[X]
SESSION
session support
安装完成后,输入rehash命令刷新

Shell:
===>
Cleaning for php5-posix-5.2.5

===>
Cleaning for php5-session-5.2.5

===>
Cleaning for php5-extensions-1.1

rehash
复制/usr/local/etc/php.ini-dist/usr/local/etc/php.ini
Shell:
cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini
重新启动Web Server
Execute the following command to start / restart the Apache webserver.
Shell:
/usr/local/etc/rc.d/apache22 restart
/usr/local/www/apache22/data/目录下建立一个test.php文件进行php测试
建立的test.php文件内容如下
Shell:
vi /usr/local/www/apache22/data/test.php

Editor:
<?
phpinfo();
?>
用浏览器打开http://yourip/test.php如显示信息,证明php工作正常。

论坛徽章:
0
7 [报告]
发表于 2007-11-29 13:38 |只看该作者

Step 4 Installation Pure-FTPd.


Installation of the Pure-FTPd:
跟随下面步骤安装 Pure-FTPd
使用Ports方式安装Pure-FTPdPorts安装目录/usr/ports/www/apache22目录,执行make install clean进行安装。
Shell:
whereis pure-ftpd
pure-ftpd: /usr/ports/ftp/pure-ftpd
cd /usr/ports/ftp/pure-ftpd/
make with_language=simplified-chinese install

安装时,会要求进行php5选项设定,这里选择如下
Options for pure-ftpd 1.0.21_1
[X]
MYSQL
Support for users in MySQL database
[X]
PRIVSEP
Enable privilege separation
[X]
PERUSERLIMITS
Per-user concurrency limits
[X]
THROTTLING
Bandwidth throttling
[X]
BANNER
Show pure-ftpd welcome upon session start
[X]
UTF8
Support for charset conversion (expreimental)
安装完成后,输入rehash命令刷新
Shell:
===>
Compressing manual pages for pure-ftpd-1.0.21_1

===>
Registering installation for pure-ftpd-1.0.21_1

rehash
系统提示,需要添加pureftpd_enable=”YES”/etc/rc.conf文件。
(具体信息可以查看cat cat /usr/local/etc/rc.d/pure-ftpd会有详细说明)
Shell:
vi /etc/rc.conf
添加以下内容
Editor:
#Pure-FTPd
pureftpd_enable="YES"
保存退出。

论坛徽章:
0
8 [报告]
发表于 2007-11-29 13:38 |只看该作者

Step 5 Creating a MySQL Database.


Creating a MySQL Database:
跟随下面步骤创建一个MySQL数据库
登陆http://machiel.generaal.net/files/pureftpd/v2.x/script.mysql网站下载script.mysql脚本文件
Shell:
cd /root/
fetch "http://machiel.generaal.net/files/pureftpd/v2.x/script.mysql"

使用下载的MySQL脚本文件,建立一个数据库
Shell:
mysql -u root -p < /root/script.mysql
Enter password:此处输入你的MySQL密码

至此数据库创建完成。
数据内容:创建一个数据库Database:tpusersLogin = ftp Password = tmppasswd ,管理权限用户名是:Administrator密码:tmppasswd(采用MD5加密)

论坛徽章:
0
9 [报告]
发表于 2007-11-29 13:39 |只看该作者

Step 6 Configuration of PureFTPd.


Configuration of PureFTPd:
跟随下面步骤进行Pure-FTPd配置
1、配置pure-ftpd.conf
配置pure-ftpd.conf文件
复制/usr/local/etc/pure-ftpd.conf.samplepure-ftpd.conf
Shell:
cd /usr/local/etc/
cp /usr/local/etc/pure-ftpd.conf.sample /usr/local/etc/pure-ftpd.conf

编辑pure-ftpd.conf 文件MySQLConfigFile位置(大约116)
编辑pure-ftpd.conf 文件CreateHomeDir (大约3366)
Shell:
vi /usr/local/etc/pure-ftpd.conf


Editor:
MySQLConfigFile          /usr/local/etc/pureftpd-mysql.conf
CreateHomeDir           yes


修改前:

# MySQL configuration file (see README.MySQL)

# MySQLConfigFile                   /etc/pureftpd-mysql.conf


# Automatically create home directories if they are missing

#CreateHomeDir                      yes


修改后:

# MySQL configuration file (see README.MySQL)

MySQLConfigFile                      /usr/local/etc/pureftpd-mysql.conf


# Automatically create home directories if they are missing

CreateHomeDir                                  yes

保存退出后。

2、配置pureftpd-mysql.conf
http://machiel.generaal.net/files/pureftpd/v2.x/pureftpd-mysql.conf网站下载,pureftpd-mysql.conf文件
Shell:
cd /usr/local/etc/
fetch http://machiel.generaal.net/files/pureftpd/v2.x/pureftpd-mysql.conf

启动PurtFTPd
Shell:
/usr/local/etc/rc.d/pure-ftpd start



[ 本帖最后由 freemongolia 于 2007-11-29 13:41 编辑 ]

论坛徽章:
0
10 [报告]
发表于 2007-11-29 13:41 |只看该作者

Step 7 User manager for PureFTPd.


Installation User manager of the PureFTPd:
跟随下面步骤安装 PureFTPd管理程序.
使用Ports方式安装User manager of the PureFTPd,进入User manager of the PureFTPd所在的Ports安装目录cd /usr/ports/www/usermanager/执行make install clean进行安装。
Shell:
whereis usermanager
usermanager: /usr/ports/www/usermanager
cd /usr/ports/www/usermanager/
make install clean
安装完成后,输入rehash命令刷新
Shell:
*****************************************************************
Please check /usr/local/www/data/UserManager/readme.txt
To use this manager, you will need to compile your
Pure-FTPd with -DWITH_MYSQL
*****************************************************************
'User manager for PureFTPd' is made by M.Mastenbroek 2002 - 2005
For more info look at http://machiel.generaal.net
Version 2.1
Installation:
Run the installation wizard install.php in your web browser.
The installation wizard will lead you step by step
through the configuration of the User manager for PureFTPd.
Running:
The User manager for PureFTPd starts from the index.php file.
*****************************************************************
rehash
系统提示,需要使用浏览器打开install.php进行安装。
编辑/usr/local/etc/apache22/httpd.conf文件,添加虚拟目录
Shell:
cp /usr/local/etc/apache22/httpd.conf /usr/local/etc/apache22/httpd.conf.bak
vi /usr/local/etc/apache22/httpd.conf
添加以下内容
Editor:
Alias /ftp "/usr/local/www/data/UserManager/"
<Directory "/usr/local/www/data/UserManager">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
保存退出。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP