系统版本:ubuntu 12.04

注:特别注意版本问题尽量用最新版本

1、 准备软件包

libevent-1.4.14b-stable.tar.gz

FastDFS_v3.05.tar.gz

nginx-1.2.4.tar.gz

fastdfs-nginx-module_v1.12.tar.gz

2、 先安装libevent编译安装

tar zxvf libevent-1.4.14b-stable.tar.gz

cd  libevent-1.4.14b-stable

./configure --prefix=/usr/local/libevent

make

make install

3、 安装fastdfs

tar–zxvf FastDFS_v3.05.tar.gz

cd  FastDFS

./make.sh C_INCLUDE_PATH=/usr/local/libevent/includeLIBRARY_PATH=/usr/local/libevent/lib

./make.sh install

报错:安装需要的软件包和模块

4、 安装fastdfsnginx需要的fastdfs模块

Tar  zxvffastdfs-nginx-module_v1.05.tar.gz–C /usr/local/src/

5、 编译安装nginx

Tar zxvf nginx-1.0.5.tar.gz

Cd nginx-1.0.5

./configure --prefix=/usr/local/nginx --add-module=/usr/local/src/fastdfs-nginx-module-read-only/src

(报错

./configure: error: the HTTP rewrite module requires the PCRE library.

解决

aptitude install libpcre3-dev

 

./configure: error: the HTTP gzip module requires the zlib library.

解决

aptitude install libssl-dev

)

make

make install

 

 

 

fastdfs 报错如下

报错:

tracker_service.o: In function `tracker_service_init':

/root/FastDFS/tracker/tracker_service.c:98: undefined reference to `event_base_new'

collect2: ld returned 1 exit status

make: *** [fdfs_trackerd] Error 1

storage_service.o: In function `storage_service_init':

/root/FastDFS/storage/storage_service.c:1345: undefined reference to `event_base_new'

collect2: ld returned 1 exit status

make: *** [fdfs_storaged] Error 1

No command 'error' found, did you mean:

 Command 'perror' from package 'mysql-server-5.5' (main)

error: command not found

问题所在:当前的libevent  版本不匹配(版本较低)

解决方法:删除当前的libenent安装较高的libenent

tar zxvf libevent-1.4.14b-stable.tar.gz

 

报错:

/usr/local/src/fastdfs-nginx-module/src/common.c: In function ‘fdfs_http_request_handler’:

/usr/local/src/fastdfs-nginx-module/src/common.c:392:22: error: ‘FDFS_FILE_PATH_LEN’ undeclared (first use in this function)

/usr/local/src/fastdfs-nginx-module/src/common.c:392:22: note: each undeclared identifier is reported only once for each function it appears in

make[1]: *** [objs/addon/src/ngx_http_fastdfs_module.o] Error 1

make[1]: Leaving directory `/usr/local/src/nginx-1.0.15'

make: *** [build] Error 2

问题所在:nginx+fastdfs模块版本太低

解决方法:安装版本更高的模块

tar zxvf fastdfs-nginx-module_v1.12.tar.gz