• CentOS上安装分布式文件系统FastDFS & 配置和问题解决


    原文:https://my.oschina.net/wangmengjun/blog/1142982

    什么是FastDFS?

    FastDFS是一个开源的分布式文件系统,她对文件进行管理,功能包括:文件存储、文件同步、文件访问(文件上传、文件下载)等,解决了大容量存储和负载均衡的问题。特别适合以文件为载体的在线服务,如相册网站、视频网站等等。

    FastDFS服务端有两个角色:跟踪器(tracker)存储节点(storage)。跟踪器主要做调度工作,在访问上起负载均衡的作用。

    存储节点存储文件,完成文件管理的所有功能:存储、同步和提供存取接口,FastDFS同时对文件的meta data进行管理。所谓文件的meta data就是文件的相关属性,以键值对(key value pair)方式表示,如:width=1024,其中的key为width,value为1024。文件meta data是文件属性列表,可以包含多个键值对。

    FastDFS系统结构如下图所示:

    可以参考【http://www.oschina.net/p/fastdfs/】获取更多的内容的介绍~

    本文的目标

    本文的目标是在CentOS上,单机安装FastDFS,包括Tracker和Storage,并结合Nginx的配置,最终完成文件的上传,并通过Nginx的路径来完成静态文件内容的展示~

    废话不多说,直接开干~

    安装准备

    安装依赖库

    在安装FastDFS和Nginx之前,需确保gcc、gcc-c++、 libstdc++-devel、make等依赖库和工具已经安装。

    # yum -y install gcc gcc-c++ libstdc++-devel
    # yum -y groupinstall 'Development Tools' 
    # yum -y install wget 
    # yum -y install make
    

    如:

    [root@dev02 ~]# yum -y install gcc gcc-c++ libstdc++-devel
    Loaded plugins: fastestmirror
    Setting up Install Process
    Determining fastest mirrors
    ISO                                                                                                                                                                                                                                                    | 4.0 kB     00:00     
    mongodb-org-3.4                                                                                                                                                                                                                                        | 2.5 kB     00:00     
    mongodb-org-3.4/primary_db                                                                                                                                                                                                                             |  30 kB     00:00     
    Resolving Dependencies
    --> Running transaction check
    ---> Package gcc.x86_64 0:4.4.7-16.el6 will be installed
    --> Processing Dependency: libgomp = 4.4.7-16.el6 for package: gcc-4.4.7-16.el6.x86_64
    --> Processing Dependency: cpp = 4.4.7-16.el6 for package: gcc-4.4.7-16.el6.x86_64
    --> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.4.7-16.el6.x86_64
    --> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.7-16.el6.x86_64
    --> Processing Dependency: libgomp.so.1()(64bit) for package: gcc-4.4.7-16.el6.x86_64
    ---> Package gcc-c++.x86_64 0:4.4.7-16.el6 will be installed
    --> Processing Dependency: libmpfr.so.1()(64bit) for package: gcc-c++-4.4.7-16.el6.x86_64
    ---> Package libstdc++-devel.x86_64 0:4.4.7-16.el6 will be installed
    --> Running transaction check
    ---> Package cloog-ppl.x86_64 0:0.15.7-1.2.el6 will be installed
    --> Processing Dependency: libppl_c.so.2()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
    --> Processing Dependency: libppl.so.7()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
    ---> Package cpp.x86_64 0:4.4.7-16.el6 will be installed
    ---> Package glibc-devel.x86_64 0:2.12-1.166.el6 will be installed
    --> Processing Dependency: glibc-headers = 2.12-1.166.el6 for package: glibc-devel-2.12-1.166.el6.x86_64
    --> Processing Dependency: glibc-headers for package: glibc-devel-2.12-1.166.el6.x86_64
    ---> Package libgomp.x86_64 0:4.4.7-16.el6 will be installed
    ---> Package mpfr.x86_64 0:2.4.1-6.el6 will be installed
    --> Running transaction check
    ---> Package glibc-headers.x86_64 0:2.12-1.166.el6 will be installed
    --> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.12-1.166.el6.x86_64
    --> Processing Dependency: kernel-headers for package: glibc-headers-2.12-1.166.el6.x86_64
    ---> Package ppl.x86_64 0:0.10.2-11.el6 will be installed
    --> Running transaction check
    ---> Package kernel-headers.x86_64 0:2.6.32-573.el6 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ==============================================================================================================================================================================================================================================================================
     Package                                                                Arch                                                          Version                                                                Repository                                                  Size
    ==============================================================================================================================================================================================================================================================================
    Installing:
     gcc                                                                    x86_64                                                        4.4.7-16.el6                                                           ISO                                                         10 M
     gcc-c++                                                                x86_64                                                        4.4.7-16.el6                                                           ISO                                                        4.7 M
     libstdc++-devel                                                        x86_64                                                        4.4.7-16.el6                                                           ISO                                                        1.6 M
    Installing for dependencies:
     cloog-ppl                                                              x86_64                                                        0.15.7-1.2.el6                                                         ISO                                                         93 k
     cpp                                                                    x86_64                                                        4.4.7-16.el6                                                           ISO                                                        3.7 M
     glibc-devel                                                            x86_64                                                        2.12-1.166.el6                                                         ISO                                                        985 k
     glibc-headers                                                          x86_64                                                        2.12-1.166.el6                                                         ISO                                                        614 k
     kernel-headers                                                         x86_64                                                        2.6.32-573.el6                                                         ISO                                                        3.9 M
     libgomp                                                                x86_64                                                        4.4.7-16.el6                                                           ISO                                                        134 k
     mpfr                                                                   x86_64                                                        2.4.1-6.el6                                                            ISO                                                        157 k
     ppl                                                                    x86_64                                                        0.10.2-11.el6                                                          ISO                                                        1.3 M
    
    Transaction Summary
    ==============================================================================================================================================================================================================================================================================
    Install      11 Package(s)
    
    Total download size: 27 M
    Installed size: 59 M
    Downloading Packages:
    (1/11): kernel-headers-2.6.32-573.el6.x86_64.rpm                                                                                                                                                                                                       | 3.9 MB     00:00     
    (2/11): libgomp-4.4.7-16.el6.x86_64.rpm                                                                                                                                                                                                                | 134 kB     00:00     
    (3/11): gcc-c++-4.4.7-16.el6.x86_64.rpm                                                                                                                                                                                                                | 4.7 MB     00:00     
    (4/11): gcc-4.4.7-16.el6.x86_64.rpm                                                                                                                                                                                                                    |  10 MB     00:00     
    (5/11): mpfr-2.4.1-6.el6.x86_64.rpm                                                                                                                                                                                                                    | 157 kB     00:00     
    (6/11): glibc-headers-2.12-1.166.el6.x86_64.rpm                                                                                                                                                                                                        | 614 kB     00:00     
    (7/11): cpp-4.4.7-16.el6.x86_64.rpm                                                                                                                                                                                                                    | 3.7 MB     00:00     
    (8/11): libstdc++-devel-4.4.7-16.el6.x86_64.rpm                                                                                                                                                                                                        | 1.6 MB     00:00     
    (9/11): ppl-0.10.2-11.el6.x86_64.rpm                                                                                                                                                                                                                   | 1.3 MB     00:00     
    (10/11): cloog-ppl-0.15.7-1.2.el6.x86_64.rpm                                                                                                                                                                                                           |  93 kB     00:00     
    (11/11): glibc-devel-2.12-1.166.el6.x86_64.rpm                                                                                                                                                                                                         | 985 kB     00:00     
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Total                                                                                                                                                                                                                                          47 MB/s |  27 MB     00:00     
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing : mpfr-2.4.1-6.el6.x86_64                                                                                                                                                                                                                                   1/11 
      Installing : cpp-4.4.7-16.el6.x86_64                                                                                                                                                                                                                                   2/11 
      Installing : ppl-0.10.2-11.el6.x86_64                                                                                                                                                                                                                                  3/11 
      Installing : cloog-ppl-0.15.7-1.2.el6.x86_64                                                                                                                                                                                                                           4/11 
      Installing : libstdc++-devel-4.4.7-16.el6.x86_64                                                                                                                                                                                                                       5/11 
      Installing : libgomp-4.4.7-16.el6.x86_64                                                                                                                                                                                                                               6/11 
      Installing : kernel-headers-2.6.32-573.el6.x86_64                                                                                                                                                                                                                      7/11 
      Installing : glibc-headers-2.12-1.166.el6.x86_64                                                                                                                                                                                                                       8/11 
      Installing : glibc-devel-2.12-1.166.el6.x86_64                                                                                                                                                                                                                         9/11 
      Installing : gcc-4.4.7-16.el6.x86_64                                                                                                                                                                                                                                  10/11 
      Installing : gcc-c++-4.4.7-16.el6.x86_64                                                                                                                                                                                                                              11/11 
      Verifying  : kernel-headers-2.6.32-573.el6.x86_64                                                                                                                                                                                                                      1/11 
      Verifying  : libgomp-4.4.7-16.el6.x86_64                                                                                                                                                                                                                               2/11 
      Verifying  : gcc-c++-4.4.7-16.el6.x86_64                                                                                                                                                                                                                               3/11 
      Verifying  : gcc-4.4.7-16.el6.x86_64                                                                                                                                                                                                                                   4/11 
      Verifying  : mpfr-2.4.1-6.el6.x86_64                                                                                                                                                                                                                                   5/11 
      Verifying  : glibc-headers-2.12-1.166.el6.x86_64                                                                                                                                                                                                                       6/11 
      Verifying  : cpp-4.4.7-16.el6.x86_64                                                                                                                                                                                                                                   7/11 
      Verifying  : libstdc++-devel-4.4.7-16.el6.x86_64                                                                                                                                                                                                                       8/11 
      Verifying  : ppl-0.10.2-11.el6.x86_64                                                                                                                                                                                                                                  9/11 
      Verifying  : cloog-ppl-0.15.7-1.2.el6.x86_64                                                                                                                                                                                                                          10/11 
      Verifying  : glibc-devel-2.12-1.166.el6.x86_64                                                                                                                                                                                                                        11/11 
    
    Installed:
      gcc.x86_64 0:4.4.7-16.el6                                                           gcc-c++.x86_64 0:4.4.7-16.el6                                                           libstdc++-devel.x86_64 0:4.4.7-16.el6                                                          
    
    Dependency Installed:
      cloog-ppl.x86_64 0:0.15.7-1.2.el6  cpp.x86_64 0:4.4.7-16.el6  glibc-devel.x86_64 0:2.12-1.166.el6  glibc-headers.x86_64 0:2.12-1.166.el6  kernel-headers.x86_64 0:2.6.32-573.el6  libgomp.x86_64 0:4.4.7-16.el6  mpfr.x86_64 0:2.4.1-6.el6  ppl.x86_64 0:0.10.2-11.el6 
    
    Complete!
    [root@dev02 ~]# 
    

    安装libfastcommon类库

    安装FastDFS必须先安装libfastcommon类库,否则会导致报错,安装直接根据如下几个步骤即可~

    # wget https://github.com/happyfish100/libfastcommon/archive/master.zip
    # unzip master.zip
    # cd libfastcommon-master
    # ./make.sh
    # ./make.sh install
    

    下载

    使用

    wget https://github.com/happyfish100/libfastcommon/archive/master.zip

    命令下载安装包~

    如:

    [root@dev02 srv]#  wget https://github.com/happyfish100/libfastcommon/archive/master.zip
    --2017-06-30 12:17:40--  https://github.com/happyfish100/libfastcommon/archive/master.zip
    Resolving github.com... 192.30.255.113, 192.30.255.112
    Connecting to github.com|192.30.255.113|:443... connected.
    HTTP request sent, awaiting response... 302 Found
    Location: https://codeload.github.com/happyfish100/libfastcommon/zip/master [following]
    --2017-06-30 12:17:41--  https://codeload.github.com/happyfish100/libfastcommon/zip/master
    Resolving codeload.github.com... 192.30.255.120, 192.30.255.121
    Connecting to codeload.github.com|192.30.255.120|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: unspecified [application/zip]
    Saving to: “master.zip”
    
        [        <=>                                                                                                                                                                                                                          ] 478,889      303K/s   in 1.5s    
    
    2017-06-30 12:17:44 (303 KB/s) - “master.zip” saved [478889]
    
    [root@dev02 srv]# 

    解压

    使用unzip master.zip命令进行解压,如:

    [root@dev02 srv]# unzip master.zip
    Archive:  master.zip
    b665626818fc9b43cf8b00ef02157edfe80acc53
       creating: libfastcommon-master/
      inflating: libfastcommon-master/HISTORY  
      inflating: libfastcommon-master/INSTALL  
      inflating: libfastcommon-master/README  
       creating: libfastcommon-master/doc/
      inflating: libfastcommon-master/doc/id_generator-Chinese.pdf  
      inflating: libfastcommon-master/doc/ini_file_reader-Chinese.pdf  
      inflating: libfastcommon-master/doc/php_log_file_performance-Chinese.pdf  
      inflating: libfastcommon-master/libfastcommon.spec  
      inflating: libfastcommon-master/make.sh  
       creating: libfastcommon-master/php-fastcommon/
      inflating: libfastcommon-master/php-fastcommon/config.m4  
      inflating: libfastcommon-master/php-fastcommon/fastcommon.c  
      inflating: libfastcommon-master/php-fastcommon/fastcommon.h  
     extracting: libfastcommon-master/php-fastcommon/fastcommon.ini  
      inflating: libfastcommon-master/php-fastcommon/php-fastcommon.spec.in  
      inflating: libfastcommon-master/php-fastcommon/test.php  
      inflating: libfastcommon-master/php-fastcommon/test_error_log.php  
      inflating: libfastcommon-master/php-fastcommon/test_file_put_contents.php  
       creating: libfastcommon-master/src/
      inflating: libfastcommon-master/src/Makefile.in  
      inflating: libfastcommon-master/src/avl_tree.c  
      inflating: libfastcommon-master/src/avl_tree.h  
      inflating: libfastcommon-master/src/base64.c  
      inflating: libfastcommon-master/src/base64.h  
      inflating: libfastcommon-master/src/chain.c  
      inflating: libfastcommon-master/src/chain.h  
      inflating: libfastcommon-master/src/char_convert_loader.c  
      inflating: libfastcommon-master/src/char_convert_loader.h  
      inflating: libfastcommon-master/src/char_converter.c  
      inflating: libfastcommon-master/src/char_converter.h  
      inflating: libfastcommon-master/src/common_define.h  
      inflating: libfastcommon-master/src/connection_pool.c  
      inflating: libfastcommon-master/src/connection_pool.h  
      inflating: libfastcommon-master/src/fast_allocator.c  
      inflating: libfastcommon-master/src/fast_allocator.h  
      inflating: libfastcommon-master/src/fast_blocked_queue.c  
      inflating: libfastcommon-master/src/fast_blocked_queue.h  
      inflating: libfastcommon-master/src/fast_buffer.c  
      inflating: libfastcommon-master/src/fast_buffer.h  
      inflating: libfastcommon-master/src/fast_link_library.sh  
      inflating: libfastcommon-master/src/fast_mblock.c  
      inflating: libfastcommon-master/src/fast_mblock.h  
      inflating: libfastcommon-master/src/fast_mpool.c  
      inflating: libfastcommon-master/src/fast_mpool.h  
      inflating: libfastcommon-master/src/fast_task_queue.c  
      inflating: libfastcommon-master/src/fast_task_queue.h  
      inflating: libfastcommon-master/src/fast_timer.c  
      inflating: libfastcommon-master/src/fast_timer.h  
      inflating: libfastcommon-master/src/flat_skiplist.c  
      inflating: libfastcommon-master/src/flat_skiplist.h  
      inflating: libfastcommon-master/src/hash.c  
      inflating: libfastcommon-master/src/hash.h  
      inflating: libfastcommon-master/src/http_func.c  
      inflating: libfastcommon-master/src/http_func.h  
      inflating: libfastcommon-master/src/id_generator.c  
      inflating: libfastcommon-master/src/id_generator.h  
      inflating: libfastcommon-master/src/ini_file_reader.c  
      inflating: libfastcommon-master/src/ini_file_reader.h  
      inflating: libfastcommon-master/src/io_opt.c  
      inflating: libfastcommon-master/src/io_opt.h  
      inflating: libfastcommon-master/src/ioevent.c  
      inflating: libfastcommon-master/src/ioevent.h  
      inflating: libfastcommon-master/src/ioevent_loop.c  
      inflating: libfastcommon-master/src/ioevent_loop.h  
      inflating: libfastcommon-master/src/local_ip_func.c  
      inflating: libfastcommon-master/src/local_ip_func.h  
      inflating: libfastcommon-master/src/logger.c  
      inflating: libfastcommon-master/src/logger.h  
      inflating: libfastcommon-master/src/md5.c  
      inflating: libfastcommon-master/src/md5.h  
      inflating: libfastcommon-master/src/multi_skiplist.c  
      inflating: libfastcommon-master/src/multi_skiplist.h  
      inflating: libfastcommon-master/src/php7_ext_wrapper.h  
      inflating: libfastcommon-master/src/process_ctrl.c  
      inflating: libfastcommon-master/src/process_ctrl.h  
      inflating: libfastcommon-master/src/pthread_func.c  
      inflating: libfastcommon-master/src/pthread_func.h  
      inflating: libfastcommon-master/src/pthread_pool.c  
      inflating: libfastcommon-master/src/pthread_pool.h  
      inflating: libfastcommon-master/src/sched_thread.c  
      inflating: libfastcommon-master/src/sched_thread.h  
      inflating: libfastcommon-master/src/shared_func.c  
      inflating: libfastcommon-master/src/shared_func.h  
      inflating: libfastcommon-master/src/skiplist.h  
      inflating: libfastcommon-master/src/skiplist_common.h  
      inflating: libfastcommon-master/src/sockopt.c  
      inflating: libfastcommon-master/src/sockopt.h  
      inflating: libfastcommon-master/src/system_info.c  
      inflating: libfastcommon-master/src/system_info.h  
       creating: libfastcommon-master/src/tests/
      inflating: libfastcommon-master/src/tests/Makefile  
      inflating: libfastcommon-master/src/tests/test.ini  
      inflating: libfastcommon-master/src/tests/test_allocator.c  
      inflating: libfastcommon-master/src/tests/test_blocked_queue.c  
      inflating: libfastcommon-master/src/tests/test_char_convert.c  
      inflating: libfastcommon-master/src/tests/test_char_convert_loader.c  
      inflating: libfastcommon-master/src/tests/test_id_generator.c  
      inflating: libfastcommon-master/src/tests/test_ini_parser.c  
      inflating: libfastcommon-master/src/tests/test_logger.c  
      inflating: libfastcommon-master/src/tests/test_mblock.c  
      inflating: libfastcommon-master/src/tests/test_multi_skiplist.c  
      inflating: libfastcommon-master/src/tests/test_skiplist.c  

    然后进入解压后的目录libfastcommon-master

    cd libfastcommon-master

    make

    使用 ./make.sh 命令执行编译~

    [root@dev02 libfastcommon-master]# ./make.sh
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o md5.lo md5.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o pthread_func.lo pthread_func.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o local_ip_func.lo local_ip_func.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o avl_tree.lo avl_tree.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o ioevent.lo ioevent.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o ioevent_loop.lo ioevent_loop.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o fast_task_queue.lo fast_task_queue.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o fast_timer.lo fast_timer.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o process_ctrl.lo process_ctrl.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o fast_mblock.lo fast_mblock.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o connection_pool.lo connection_pool.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o fast_mpool.lo fast_mpool.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o fast_allocator.lo fast_allocator.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o fast_buffer.lo fast_buffer.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o multi_skiplist.lo multi_skiplist.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o flat_skiplist.lo flat_skiplist.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o system_info.lo system_info.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o fast_blocked_queue.lo fast_blocked_queue.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o id_generator.lo id_generator.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o char_converter.lo char_converter.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -fPIC -o char_convert_loader.lo char_convert_loader.c  
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -o libfastcommon.so  -shared hash.lo chain.lo shared_func.lo ini_file_reader.lo logger.lo sockopt.lo base64.lo sched_thread.lo http_func.lo md5.lo pthread_func.lo local_ip_func.lo avl_tree.lo ioevent.lo ioevent_loop.lo fast_task_queue.lo fast_timer.lo process_ctrl.lo fast_mblock.lo connection_pool.lo fast_mpool.lo fast_allocator.lo fast_buffer.lo multi_skiplist.lo flat_skiplist.lo system_info.lo fast_blocked_queue.lo id_generator.lo char_converter.lo char_convert_loader.lo -lm -lpthread
    ar rcs libfastcommon.a hash.o chain.o shared_func.o ini_file_reader.o logger.o sockopt.o base64.o sched_thread.o http_func.o md5.o pthread_func.o local_ip_func.o avl_tree.o ioevent.o ioevent_loop.o fast_task_queue.o fast_timer.o process_ctrl.o fast_mblock.o connection_pool.o fast_mpool.o fast_allocator.o fast_buffer.o multi_skiplist.o flat_skiplist.o system_info.o fast_blocked_queue.o id_generator.o char_converter.o char_convert_loader.o
    [root@dev02 libfastcommon-master]# 
    

    make install

    使用 ./make.sh install命令执行安装~

    [root@dev02 libfastcommon-master]# ./make.sh install
    mkdir -p /usr/lib64
    mkdir -p /usr/lib
    install -m 755 libfastcommon.so /usr/lib64
    install -m 755 libfastcommon.so /usr/lib
    mkdir -p /usr/include/fastcommon
    install -m 644 common_define.h hash.h chain.h logger.h base64.h shared_func.h pthread_func.h ini_file_reader.h _os_define.h sockopt.h sched_thread.h http_func.h md5.h local_ip_func.h avl_tree.h ioevent.h ioevent_loop.h fast_task_queue.h fast_timer.h process_ctrl.h fast_mblock.h connection_pool.h fast_mpool.h fast_allocator.h fast_buffer.h skiplist.h multi_skiplist.h flat_skiplist.h skiplist_common.h system_info.h fast_blocked_queue.h php7_ext_wrapper.h id_generator.h char_converter.h char_convert_loader.h /usr/include/fastcommon
    [root@dev02 libfastcommon-master]# 
    

    这样,libfastcommon-master就安装完成了~ 

    接下来,就可以安装

    FastDFS

    FastDFS的安装也比较简单,只要如下几个步骤即可~

    # wget https://github.com/happyfish100/fastdfs/archive/master.tar.gz
    # tar -zxvf master.tar.gz  
    # cd fastdfs-master/
    # ./make.sh
    # ./make.sh install
    

    下载

    使用

    wget https://github.com/happyfish100/fastdfs/archive/master.tar.gz

    命令下载FastDFS安装包~

    如:

    [root@dev02 srv]# wget  https://github.com/happyfish100/fastdfs/archive/master.tar.gz
    --2017-06-30 12:10:14--  https://github.com/happyfish100/fastdfs/archive/master.tar.gz
    Resolving github.com... 192.30.255.112, 192.30.255.113
    Connecting to github.com|192.30.255.112|:443... connected.
    HTTP request sent, awaiting response... 302 Found
    Location: https://codeload.github.com/happyfish100/fastdfs/tar.gz/master [following]
    --2017-06-30 12:10:15--  https://codeload.github.com/happyfish100/fastdfs/tar.gz/master
    Resolving codeload.github.com... 192.30.255.120, 192.30.255.121
    Connecting to codeload.github.com|192.30.255.120|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: unspecified [application/x-gzip]
    Saving to: “master.tar.gz”
    
        [       <=>                                                                                                                                                                                                                           ] 336,932      245K/s   in 1.3s    
    
    2017-06-30 12:10:17 (245 KB/s) - “master.tar.gz” saved [336932]
    
    [root@dev02 srv]# 

    解压master.tar.gz

    [root@dev02 srv]# tar -zxvf master.tar.gz 
    fastdfs-master/
    fastdfs-master/COPYING-3_0.txt
    fastdfs-master/HISTORY
    fastdfs-master/INSTALL
    fastdfs-master/README.md
    fastdfs-master/client/
    fastdfs-master/client/Makefile.in
    fastdfs-master/client/client_func.c
    fastdfs-master/client/client_func.h
    fastdfs-master/client/client_global.c
    fastdfs-master/client/client_global.h
    fastdfs-master/client/fdfs_append_file.c
    fastdfs-master/client/fdfs_appender_test.c
    fastdfs-master/client/fdfs_appender_test1.c
    fastdfs-master/client/fdfs_client.h
    fastdfs-master/client/fdfs_crc32.c
    fastdfs-master/client/fdfs_delete_file.c
    fastdfs-master/client/fdfs_download_file.c
    fastdfs-master/client/fdfs_file_info.c
    fastdfs-master/client/fdfs_link_library.sh.in
    fastdfs-master/client/fdfs_monitor.c
    fastdfs-master/client/fdfs_test.c
    fastdfs-master/client/fdfs_test1.c
    fastdfs-master/client/fdfs_upload_appender.c
    fastdfs-master/client/fdfs_upload_file.c
    fastdfs-master/client/storage_client.c
    fastdfs-master/client/storage_client.h
    fastdfs-master/client/storage_client1.h
    fastdfs-master/client/test/
    fastdfs-master/client/test/Makefile.in
    fastdfs-master/client/test/fdfs_monitor.c
    fastdfs-master/client/test/fdfs_test.c
    fastdfs-master/client/test/fdfs_test1.c
    fastdfs-master/client/tracker_client.c
    fastdfs-master/client/tracker_client.h
    fastdfs-master/common/
    fastdfs-master/common/Makefile
    fastdfs-master/common/fdfs_define.h
    fastdfs-master/common/fdfs_global.c
    fastdfs-master/common/fdfs_global.h
    fastdfs-master/common/fdfs_http_shared.c
    fastdfs-master/common/fdfs_http_shared.h
    fastdfs-master/common/mime_file_parser.c
    fastdfs-master/common/mime_file_parser.h
    fastdfs-master/conf/
    fastdfs-master/conf/anti-steal.jpg
    fastdfs-master/conf/client.conf
    fastdfs-master/conf/http.conf
    fastdfs-master/conf/mime.types
    fastdfs-master/conf/storage.conf
    fastdfs-master/conf/storage_ids.conf
    fastdfs-master/conf/tracker.conf
    fastdfs-master/fastdfs.spec
    fastdfs-master/init.d/
    fastdfs-master/init.d/fdfs_storaged
    fastdfs-master/init.d/fdfs_trackerd
    fastdfs-master/make.sh
    fastdfs-master/php_client/
    fastdfs-master/php_client/README
    fastdfs-master/php_client/config.m4
    fastdfs-master/php_client/fastdfs_appender_test.php
    fastdfs-master/php_client/fastdfs_appender_test1.php
    fastdfs-master/php_client/fastdfs_callback_test.php
    fastdfs-master/php_client/fastdfs_client.c
    fastdfs-master/php_client/fastdfs_client.h
    fastdfs-master/php_client/fastdfs_client.ini
    fastdfs-master/php_client/fastdfs_client.spec.in
    fastdfs-master/php_client/fastdfs_test.php
    fastdfs-master/php_client/fastdfs_test1.php
    fastdfs-master/php_client/fastdfs_test_slave.php
    fastdfs-master/restart.sh
    fastdfs-master/stop.sh
    fastdfs-master/storage/
    fastdfs-master/storage/Makefile.in
    fastdfs-master/storage/fdfs_storaged.c
    fastdfs-master/storage/fdht_client/
    fastdfs-master/storage/fdht_client/fdht_client.c
    fastdfs-master/storage/fdht_client/fdht_client.h
    fastdfs-master/storage/fdht_client/fdht_define.h
    fastdfs-master/storage/fdht_client/fdht_func.c
    fastdfs-master/storage/fdht_client/fdht_func.h
    fastdfs-master/storage/fdht_client/fdht_global.c
    fastdfs-master/storage/fdht_client/fdht_global.h
    fastdfs-master/storage/fdht_client/fdht_proto.c
    fastdfs-master/storage/fdht_client/fdht_proto.h
    fastdfs-master/storage/fdht_client/fdht_proto_types.h
    fastdfs-master/storage/fdht_client/fdht_types.h
    fastdfs-master/storage/storage_dio.c
    fastdfs-master/storage/storage_dio.h
    fastdfs-master/storage/storage_disk_recovery.c
    fastdfs-master/storage/storage_disk_recovery.h
    fastdfs-master/storage/storage_dump.c
    fastdfs-master/storage/storage_dump.h
    fastdfs-master/storage/storage_func.c
    fastdfs-master/storage/storage_func.h
    fastdfs-master/storage/storage_global.c
    fastdfs-master/storage/storage_global.h
    fastdfs-master/storage/storage_ip_changed_dealer.c
    fastdfs-master/storage/storage_ip_changed_dealer.h
    fastdfs-master/storage/storage_nio.c
    fastdfs-master/storage/storage_nio.h
    fastdfs-master/storage/storage_param_getter.c
    fastdfs-master/storage/storage_param_getter.h
    fastdfs-master/storage/storage_service.c
    fastdfs-master/storage/storage_service.h
    fastdfs-master/storage/storage_sync.c
    fastdfs-master/storage/storage_sync.h
    fastdfs-master/storage/tracker_client_thread.c
    fastdfs-master/storage/tracker_client_thread.h
    fastdfs-master/storage/trunk_mgr/
    fastdfs-master/storage/trunk_mgr/trunk_client.c
    fastdfs-master/storage/trunk_mgr/trunk_client.h
    fastdfs-master/storage/trunk_mgr/trunk_free_block_checker.c
    fastdfs-master/storage/trunk_mgr/trunk_free_block_checker.h
    fastdfs-master/storage/trunk_mgr/trunk_mem.c
    fastdfs-master/storage/trunk_mgr/trunk_mem.h
    fastdfs-master/storage/trunk_mgr/trunk_shared.c
    fastdfs-master/storage/trunk_mgr/trunk_shared.h
    fastdfs-master/storage/trunk_mgr/trunk_sync.c
    fastdfs-master/storage/trunk_mgr/trunk_sync.h
    fastdfs-master/test/
    fastdfs-master/test/Makefile
    fastdfs-master/test/combine_result.c
    fastdfs-master/test/common_func.c
    fastdfs-master/test/common_func.h
    fastdfs-master/test/dfs_func.c
    fastdfs-master/test/dfs_func.h
    fastdfs-master/test/dfs_func_pc.c
    fastdfs-master/test/gen_files.c
    fastdfs-master/test/test_delete.c
    fastdfs-master/test/test_delete.sh
    fastdfs-master/test/test_download.c
    fastdfs-master/test/test_download.sh
    fastdfs-master/test/test_types.h
    fastdfs-master/test/test_upload.c
    fastdfs-master/test/test_upload.sh
    fastdfs-master/tracker/
    fastdfs-master/tracker/Makefile.in
    fastdfs-master/tracker/fdfs_shared_func.c
    fastdfs-master/tracker/fdfs_shared_func.h
    fastdfs-master/tracker/fdfs_trackerd.c
    fastdfs-master/tracker/tracker_dump.c
    fastdfs-master/tracker/tracker_dump.h
    fastdfs-master/tracker/tracker_func.c
    fastdfs-master/tracker/tracker_func.h
    fastdfs-master/tracker/tracker_global.c
    fastdfs-master/tracker/tracker_global.h
    fastdfs-master/tracker/tracker_http_check.c
    fastdfs-master/tracker/tracker_http_check.h
    fastdfs-master/tracker/tracker_mem.c
    fastdfs-master/tracker/tracker_mem.h
    fastdfs-master/tracker/tracker_nio.c
    fastdfs-master/tracker/tracker_nio.h
    fastdfs-master/tracker/tracker_proto.c
    fastdfs-master/tracker/tracker_proto.h
    fastdfs-master/tracker/tracker_relationship.c
    fastdfs-master/tracker/tracker_relationship.h
    fastdfs-master/tracker/tracker_service.c
    fastdfs-master/tracker/tracker_service.h
    fastdfs-master/tracker/tracker_status.c
    fastdfs-master/tracker/tracker_status.h
    fastdfs-master/tracker/tracker_types.h
    [root@dev02 srv]# 
    

    进入解压后的FastDFS文件目录~, 如:

    [root@dev02 srv]# cd fastdfs-master/
    [root@dev02 fastdfs-master]# ll
    total 136
    drwxrwxr-x 3 root root  4096 Jun  3 21:09 client
    drwxrwxr-x 2 root root  4096 Jun  3 21:09 common
    drwxrwxr-x 2 root root  4096 Jun  3 21:09 conf
    -rw-rw-r-- 1 root root 35067 Jun  3 21:09 COPYING-3_0.txt
    -rw-rw-r-- 1 root root  3171 Jun  3 21:09 fastdfs.spec
    -rw-rw-r-- 1 root root 33100 Jun  3 21:09 HISTORY
    drwxrwxr-x 2 root root  4096 Jun  3 21:09 init.d
    -rw-rw-r-- 1 root root  7755 Jun  3 21:09 INSTALL
    -rwxrwxr-x 1 root root  5548 Jun  3 21:09 make.sh
    drwxrwxr-x 2 root root  4096 Jun  3 21:09 php_client
    -rw-rw-r-- 1 root root  2380 Jun  3 21:09 README.md
    -rwxrwxr-x 1 root root  1768 Jun  3 21:09 restart.sh
    -rwxrwxr-x 1 root root  1680 Jun  3 21:09 stop.sh
    drwxrwxr-x 4 root root  4096 Jun  3 21:09 storage
    drwxrwxr-x 2 root root  4096 Jun  3 21:09 test
    drwxrwxr-x 2 root root  4096 Jun  3 21:09 tracker
    [root@dev02 fastdfs-master]

    make

    [root@dev02 fastdfs-master]# ./make.sh
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o ../common/fdfs_global.o ../common/fdfs_global.c  -I../common -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o tracker_proto.o tracker_proto.c  -I../common -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o tracker_mem.o tracker_mem.c  -I../common -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o tracker_service.o tracker_service.c  -I../common -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o tracker_status.o tracker_status.c  -I../common -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o tracker_global.o tracker_global.c  -I../common -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o tracker_func.o tracker_func.c  -I../common -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o fdfs_shared_func.o fdfs_shared_func.c  -I../common -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o tracker_nio.o tracker_nio.c  -I../common -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o tracker_relationship.o tracker_relationship.c  -I../common -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o tracker_dump.o tracker_dump.c  -I../common -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -o fdfs_trackerd fdfs_trackerd.c  ../common/fdfs_global.o tracker_proto.o tracker_mem.o tracker_service.o tracker_status.o tracker_global.o tracker_func.o fdfs_shared_func.o tracker_nio.o tracker_relationship.o tracker_dump.o -L/usr/lib64 -lpthread -lfastcommon -I../common -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o tracker_client_thread.o tracker_client_thread.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o storage_global.o storage_global.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o storage_func.o storage_func.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o storage_service.o storage_service.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o storage_sync.o storage_sync.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o storage_nio.o storage_nio.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o storage_dio.o storage_dio.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o storage_ip_changed_dealer.o storage_ip_changed_dealer.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o storage_param_getter.o storage_param_getter.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o storage_disk_recovery.o storage_disk_recovery.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o trunk_mgr/trunk_mem.o trunk_mgr/trunk_mem.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o trunk_mgr/trunk_shared.o trunk_mgr/trunk_shared.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o trunk_mgr/trunk_sync.o trunk_mgr/trunk_sync.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o trunk_mgr/trunk_client.o trunk_mgr/trunk_client.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o trunk_mgr/trunk_free_block_checker.o trunk_mgr/trunk_free_block_checker.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o ../client/client_global.o ../client/client_global.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o ../client/tracker_client.o ../client/tracker_client.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o ../client/storage_client.o ../client/storage_client.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o ../client/client_func.o ../client/client_func.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o fdht_client/fdht_proto.o fdht_client/fdht_proto.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o fdht_client/fdht_client.o fdht_client/fdht_client.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o fdht_client/fdht_func.o fdht_client/fdht_func.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o fdht_client/fdht_global.o fdht_client/fdht_global.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o storage_dump.o storage_dump.c  -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -o fdfs_storaged fdfs_storaged.c  ../common/fdfs_global.o ../tracker/fdfs_shared_func.o ../tracker/tracker_proto.o tracker_client_thread.o storage_global.o storage_func.o storage_service.o storage_sync.o storage_nio.o storage_dio.o storage_ip_changed_dealer.o storage_param_getter.o storage_disk_recovery.o trunk_mgr/trunk_mem.o trunk_mgr/trunk_shared.o trunk_mgr/trunk_sync.o trunk_mgr/trunk_client.o trunk_mgr/trunk_free_block_checker.o ../client/client_global.o ../client/tracker_client.o ../client/storage_client.o ../client/client_func.o fdht_client/fdht_proto.o fdht_client/fdht_client.o fdht_client/fdht_func.o fdht_client/fdht_global.o storage_dump.o -L/usr/lib64 -lpthread  -lfastcommon -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o ../common/fdfs_http_shared.o ../common/fdfs_http_shared.c  -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -o ../common/mime_file_parser.o ../common/mime_file_parser.c  -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -fPIC -o ../common/fdfs_global.lo ../common/fdfs_global.c  -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -fPIC -o ../common/fdfs_http_shared.lo ../common/fdfs_http_shared.c  -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -fPIC -o ../common/mime_file_parser.lo ../common/mime_file_parser.c  -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -fPIC -o ../tracker/tracker_proto.lo ../tracker/tracker_proto.c  -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -fPIC -o ../tracker/fdfs_shared_func.lo ../tracker/fdfs_shared_func.c  -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -fPIC -o ../storage/trunk_mgr/trunk_shared.lo ../storage/trunk_mgr/trunk_shared.c  -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -fPIC -o tracker_client.lo tracker_client.c  -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -fPIC -o client_func.lo client_func.c  -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -fPIC -o client_global.lo client_global.c  -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -c -fPIC -o storage_client.lo storage_client.c  -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -o fdfs_monitor fdfs_monitor.c  ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -L/usr/lib64 -lpthread -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -o fdfs_test fdfs_test.c  ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -L/usr/lib64 -lpthread -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -o fdfs_test1 fdfs_test1.c  ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -L/usr/lib64 -lpthread -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -o fdfs_crc32 fdfs_crc32.c  ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -L/usr/lib64 -lpthread -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -o fdfs_upload_file fdfs_upload_file.c  ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -L/usr/lib64 -lpthread -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -o fdfs_download_file fdfs_download_file.c  ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -L/usr/lib64 -lpthread -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -o fdfs_delete_file fdfs_delete_file.c  ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -L/usr/lib64 -lpthread -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -o fdfs_file_info fdfs_file_info.c  ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -L/usr/lib64 -lpthread -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -o fdfs_appender_test fdfs_appender_test.c  ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -L/usr/lib64 -lpthread -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -o fdfs_appender_test1 fdfs_appender_test1.c  ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -L/usr/lib64 -lpthread -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -o fdfs_append_file fdfs_append_file.c  ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -L/usr/lib64 -lpthread -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -o fdfs_upload_appender fdfs_upload_appender.c  ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -L/usr/lib64 -lpthread -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
    ar cru libfdfsclient.a  ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o
    cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -o libfdfsclient.so  -shared ../common/fdfs_global.lo ../common/fdfs_http_shared.lo ../common/mime_file_parser.lo ../tracker/tracker_proto.lo ../tracker/fdfs_shared_func.lo ../storage/trunk_mgr/trunk_shared.lo tracker_client.lo client_func.lo client_global.lo storage_client.lo -L/usr/lib64 -lpthread -lfastcommon
    [root@dev02 fastdfs-master]# 
    

    make install

    [root@dev02 fastdfs-master]# ./make.sh install
    mkdir -p /usr/bin
    mkdir -p /etc/fdfs
    cp -f fdfs_trackerd /usr/bin
    if [ ! -f /etc/fdfs/tracker.conf.sample ]; then cp -f ../conf/tracker.conf /etc/fdfs/tracker.conf.sample; fi
    if [ ! -f /etc/fdfs/storage_ids.conf.sample ]; then cp -f ../conf/storage_ids.conf /etc/fdfs/storage_ids.conf.sample; fi
    mkdir -p /usr/bin
    mkdir -p /etc/fdfs
    cp -f fdfs_storaged  /usr/bin
    if [ ! -f /etc/fdfs/storage.conf.sample ]; then cp -f ../conf/storage.conf /etc/fdfs/storage.conf.sample; fi
    mkdir -p /usr/bin
    mkdir -p /etc/fdfs
    mkdir -p /usr/lib64
    mkdir -p /usr/lib
    cp -f fdfs_monitor fdfs_test fdfs_test1 fdfs_crc32 fdfs_upload_file fdfs_download_file fdfs_delete_file fdfs_file_info fdfs_appender_test fdfs_appender_test1 fdfs_append_file fdfs_upload_appender /usr/bin
    if [ 0 -eq 1 ]; then cp -f libfdfsclient.a /usr/lib64; cp -f libfdfsclient.a /usr/lib/;fi
    if [ 1 -eq 1 ]; then cp -f libfdfsclient.so /usr/lib64; cp -f libfdfsclient.so /usr/lib/;fi
    mkdir -p /usr/include/fastdfs
    cp -f ../common/fdfs_define.h ../common/fdfs_global.h ../common/mime_file_parser.h ../common/fdfs_http_shared.h ../tracker/tracker_types.h ../tracker/tracker_proto.h ../tracker/fdfs_shared_func.h ../storage/trunk_mgr/trunk_shared.h tracker_client.h storage_client.h storage_client1.h client_func.h client_global.h fdfs_client.h /usr/include/fastdfs
    if [ ! -f /etc/fdfs/client.conf.sample ]; then cp -f ../conf/client.conf /etc/fdfs/client.conf.sample; fi
    [root@dev02 fastdfs-master]# 
    

    至此,FastDFS也已经安装完毕~

    安装好之后,在/usr/bin目录下,可以看fdfs开头的命令工具~

    FastDFS安装完成之后,所有配置文件在/etc/fdfs目录下,tracker需要tracker.conf配置文件,storage需要storage.conf配置文件。

    [root@dev02 fastdfs-master]# cd /etc/fdfs
    [root@dev02 fdfs]# ll
    total 24
    -rw-r--r-- 1 root root 1461 Jun 30 12:29 client.conf.sample
    -rw-r--r-- 1 root root 7927 Jun 30 12:29 storage.conf.sample
    -rw-r--r-- 1 root root  105 Jun 30 12:29 storage_ids.conf.sample
    -rw-r--r-- 1 root root 7389 Jun 30 12:29 tracker.conf.sample
    [root@dev02 fdfs]# 
    

    可以重命名sample文件或者是复制sample配置文件,并完成参数配置即可。

    如,将tracker.conf.sample文件重命名为tracker.conf,然后修改配置文件/etc/fdfs/tracker.conf。

    接下来,就去完成Tracker以及Storage的配置~

    配置Tracker

    配置tracker.conf

    可以重命名sample文件或者是复制sample配置文件,并完成参数配置即可。

    如,将tracker.conf.sample文件重命名为tracker.conf,然后修改配置文件/etc/fdfs/tracker.conf。

    本文采用复制的方式

    cp tracker.conf.sample tracker.conf

    修改参数

    一般情况下只需要修改以下几个参数即可:

    #启用配置文件
    disabled=false
    #设置tracker的端口号
    port=22122
    #设置tracker的数据文件和日志目录(需手动创建)
    base_path=/var/fastdfs/tracker
    #设置http端口号
    http.server_port=9090 
    

    启动Tracker

    启动tracker,查看端口22122是否开始监听,确认启动是否成功。

    使用 /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start尝试启动tracker~

    出现问题~

    [root@dev02 fastdfs-master]#  /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start
    [2017-06-30 12:52:57] ERROR - file: process_ctrl.c, line: 288, "/srv/fastdfs/tracker" can't be accessed, error info: No such file or directory
    [root@dev02 fastdfs-master]# ll
    

    出现问题的原因是还没有创建tracker目录,创建一个即可~

    mkdir -p /srv/fastdfs/tracker

    然后重新启动~

    [root@dev02 srv]# /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start
    [root@dev02 srv]

    没有报错~,查看端口22122是否开始监听,确认启动是否成功。

    [root@dev02 srv]# ps -ef|grep fdfs
    root     29919     1  0 13:07 ?        00:00:00 /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start
    root     29929 29884  0 13:08 pts/0    00:00:00 grep fdfs
    [root@dev02 srv]# netstat -unltp | grep fdfs
    tcp        0      0 0.0.0.0:22122               0.0.0.0:*                   LISTEN      29919/fdfs_trackerd 
    [root@dev02 srv]# 
    

    也可以查看tracker的日志是否启动成功

    [root@dev02 srv]# cat /srv/fastdfs/tracker/logs/trackerd.log
    [2017-06-30 13:07:15] INFO - FastDFS v5.11, base_path=/srv/fastdfs/tracker, run_by_group=, run_by_user=, connect_timeout=30s, network_timeout=60s, port=22122, bind_addr=, max_connections=256, accept_threads=1, work_threads=4, min_buff_size=8192, max_buff_size=131072, store_lookup=2, store_group=, store_server=0, store_path=0, reserved_storage_space=10.00%, download_server=0, allow_ip_count=-1, sync_log_buff_interval=10s, check_active_interval=120s, thread_stack_size=64 KB, storage_ip_changed_auto_adjust=1, storage_sync_file_max_delay=86400s, storage_sync_file_max_time=300s, use_trunk_file=0, slot_min_size=256, slot_max_size=16 MB, trunk_file_size=64 MB, trunk_create_file_advance=0, trunk_create_file_time_base=02:00, trunk_create_file_interval=86400, trunk_create_file_space_threshold=20 GB, trunk_init_check_occupying=0, trunk_init_reload_from_binlog=0, trunk_compress_binlog_min_interval=0, use_storage_id=0, id_type_in_filename=ip, storage_id_count=0, rotate_error_log=0, error_log_rotate_time=00:00, rotate_error_log_size=0, log_file_keep_days=0, store_slave_file_use_link=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s
    [root@dev02 srv]# 
    

    至此,一个简单的的tracker配置就完成了,Tracker也成功启动~, 接下来要做的就是完成Storage的配置~

    配置storage

    storage.conf的配置,基本步骤和tracker的配置是一致的~

    配置storage.conf

    可以重命名sample文件或者是复制sample配置文件,并完成参数配置即可。

    如,将storage.conf.sample文件重命名为storage.conf,然后修改配置文件/etc/fdfs/storage.conf。

    本文采用复制的方式

    cp storage.conf.sample storage.conf

    修改参数

    storage主要完成base_path,store_path以及tracker的连接地址以及storage的http服务端口配置等。

    主要有如下几个参数:

    #启用配置文件
    disabled=false
    #组名,根据实际情况修改
    group_name=group1
    #设置storage的端口号
    port=23000
    #设置storage的日志目录(需手动创建)
    base_path=/var/fastdfs/storage
    #存储路径个数,需要和store_path个数匹配
    store_path_count=1
    #存储路径
    store_path0=/var/fastdfs/storage
    #tracker服务器的IP地址和端口号
    tracker_server=192.168.12.193:22122
    #设置http端口号
    http.server_port=8080
    

    启动Storage

    启动storage,会根据配置文件的设置自动创建多级存储目录,查看端口23000是否开始监听,确认启动是否成功。

    /usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart

    [root@dev02 fastdfs]# /usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
    [root@dev02 fastdfs]#  netstat -unltp | grep fdfs
    tcp        0      0 0.0.0.0:22122               0.0.0.0:*                   LISTEN      29919/fdfs_trackerd 
    tcp        0      0 0.0.0.0:23000               0.0.0.0:*                   LISTEN      30265/fdfs_storaged 
    [root@dev02 fastdfs]# 
    

    可以看出来,tracker和storage都已经启动。

    也可以查看storage的日志是否启动成功。

    [root@dev02 fastdfs]# cat /srv/fastdfs/storage/logs/storaged.log ,

    可以看出storage会根据配置文件的设置自动创建多级存储目录。

    [root@dev02 fastdfs]# cat /srv/fastdfs/storage/logs/storaged.log
    [2017-06-30 14:35:43] INFO - FastDFS v5.11, base_path=/srv/fastdfs/storage, store_path_count=1, subdir_count_per_path=256, group_name=group1, run_by_group=, run_by_user=, connect_timeout=30s, network_timeout=60s, port=23000, bind_addr=, client_bind=1, max_connections=256, accept_threads=1, work_threads=4, disk_rw_separated=1, disk_reader_threads=1, disk_writer_threads=1, buff_size=256KB, heart_beat_interval=30s, stat_report_interval=60s, tracker_server_count=1, sync_wait_msec=50ms, sync_interval=0ms, sync_start_time=00:00, sync_end_time=23:59, write_mark_file_freq=500, allow_ip_count=-1, file_distribute_path_mode=0, file_distribute_rotate_count=100, fsync_after_written_bytes=0, sync_log_buff_interval=10s, sync_binlog_buff_interval=10s, sync_stat_file_interval=300s, thread_stack_size=512 KB, upload_priority=10, if_alias_prefix=, check_file_duplicate=0, file_signature_method=hash, FDHT group count=0, FDHT server count=0, FDHT key_namespace=, FDHT keep_alive=0, HTTP server port=8090, domain name=, use_access_log=0, rotate_access_log=0, access_log_rotate_time=00:00, rotate_error_log=0, error_log_rotate_time=00:00, rotate_access_log_size=0, rotate_error_log_size=0, log_file_keep_days=0, file_sync_skip_invalid_record=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s
    data path: /srv/fastdfs/storage/data, mkdir sub dir...
    mkdir data path: 00 ...
    mkdir data path: 01 ...
    mkdir data path: 02 ...
    mkdir data path: 03 ...
    mkdir data path: 04 ...
    mkdir data path: 05 ...
    mkdir data path: 06 ...
    mkdir data path: 07 ...
    mkdir data path: 08 ...
    mkdir data path: 09 ...
    mkdir data path: 0A ...
    mkdir data path: 0B ...
    mkdir data path: 0C ...
    mkdir data path: 0D ...
    mkdir data path: 0E ...
    mkdir data path: 0F ...
    mkdir data path: 10 ...
    mkdir data path: 11 ...
    mkdir data path: 12 ...
    mkdir data path: 13 ...
    mkdir data path: 14 ...
    mkdir data path: 15 ...
    mkdir data path: 16 ...
    mkdir data path: 17 ...
    mkdir data path: 18 ...
    mkdir data path: 19 ...
    mkdir data path: 1A ...
    mkdir data path: 1B ...
    mkdir data path: 1C ...
    mkdir data path: 1D ...
    mkdir data path: 1E ...
    mkdir data path: 1F ...
    mkdir data path: 20 ...
    mkdir data path: 21 ...
    mkdir data path: 22 ...
    mkdir data path: 23 ...
    mkdir data path: 24 ...
    mkdir data path: 25 ...
    mkdir data path: 26 ...
    mkdir data path: 27 ...
    mkdir data path: 28 ...
    mkdir data path: 29 ...
    mkdir data path: 2A ...
    mkdir data path: 2B ...
    mkdir data path: 2C ...
    mkdir data path: 2D ...
    mkdir data path: 2E ...
    mkdir data path: 2F ...
    mkdir data path: 30 ...
    mkdir data path: 31 ...
    mkdir data path: 32 ...
    mkdir data path: 33 ...
    mkdir data path: 34 ...
    mkdir data path: 35 ...
    mkdir data path: 36 ...
    mkdir data path: 37 ...
    mkdir data path: 38 ...
    mkdir data path: 39 ...
    mkdir data path: 3A ...
    mkdir data path: 3B ...
    mkdir data path: 3C ...
    mkdir data path: 3D ...
    mkdir data path: 3E ...
    mkdir data path: 3F ...
    mkdir data path: 40 ...
    mkdir data path: 41 ...
    mkdir data path: 42 ...
    mkdir data path: 43 ...
    mkdir data path: 44 ...
    mkdir data path: 45 ...
    mkdir data path: 46 ...
    mkdir data path: 47 ...
    mkdir data path: 48 ...
    mkdir data path: 49 ...
    mkdir data path: 4A ...
    mkdir data path: 4B ...
    mkdir data path: 4C ...
    mkdir data path: 4D ...
    mkdir data path: 4E ...
    mkdir data path: 4F ...
    mkdir data path: 50 ...
    mkdir data path: 51 ...
    mkdir data path: 52 ...
    mkdir data path: 53 ...
    mkdir data path: 54 ...
    mkdir data path: 55 ...
    mkdir data path: 56 ...
    mkdir data path: 57 ...
    mkdir data path: 58 ...
    mkdir data path: 59 ...
    mkdir data path: 5A ...
    mkdir data path: 5B ...
    mkdir data path: 5C ...
    mkdir data path: 5D ...
    mkdir data path: 5E ...
    mkdir data path: 5F ...
    mkdir data path: 60 ...
    mkdir data path: 61 ...
    mkdir data path: 62 ...
    mkdir data path: 63 ...
    mkdir data path: 64 ...
    mkdir data path: 65 ...
    mkdir data path: 66 ...
    mkdir data path: 67 ...
    mkdir data path: 68 ...
    mkdir data path: 69 ...
    mkdir data path: 6A ...
    mkdir data path: 6B ...
    mkdir data path: 6C ...
    mkdir data path: 6D ...
    mkdir data path: 6E ...
    mkdir data path: 6F ...
    mkdir data path: 70 ...
    mkdir data path: 71 ...
    mkdir data path: 72 ...
    mkdir data path: 73 ...
    mkdir data path: 74 ...
    mkdir data path: 75 ...
    mkdir data path: 76 ...
    mkdir data path: 77 ...
    mkdir data path: 78 ...
    mkdir data path: 79 ...
    mkdir data path: 7A ...
    mkdir data path: 7B ...
    mkdir data path: 7C ...
    mkdir data path: 7D ...
    mkdir data path: 7E ...
    mkdir data path: 7F ...
    mkdir data path: 80 ...
    mkdir data path: 81 ...
    mkdir data path: 82 ...
    mkdir data path: 83 ...
    mkdir data path: 84 ...
    mkdir data path: 85 ...
    mkdir data path: 86 ...
    mkdir data path: 87 ...
    mkdir data path: 88 ...
    mkdir data path: 89 ...
    mkdir data path: 8A ...
    mkdir data path: 8B ...
    mkdir data path: 8C ...
    mkdir data path: 8D ...
    mkdir data path: 8E ...
    mkdir data path: 8F ...
    mkdir data path: 90 ...
    mkdir data path: 91 ...
    mkdir data path: 92 ...
    mkdir data path: 93 ...
    mkdir data path: 94 ...
    mkdir data path: 95 ...
    mkdir data path: 96 ...
    mkdir data path: 97 ...
    mkdir data path: 98 ...
    mkdir data path: 99 ...
    mkdir data path: 9A ...
    mkdir data path: 9B ...
    mkdir data path: 9C ...
    mkdir data path: 9D ...
    mkdir data path: 9E ...
    mkdir data path: 9F ...
    mkdir data path: A0 ...
    mkdir data path: A1 ...
    mkdir data path: A2 ...
    mkdir data path: A3 ...
    mkdir data path: A4 ...
    mkdir data path: A5 ...
    mkdir data path: A6 ...
    mkdir data path: A7 ...
    mkdir data path: A8 ...
    mkdir data path: A9 ...
    mkdir data path: AA ...
    mkdir data path: AB ...
    mkdir data path: AC ...
    mkdir data path: AD ...
    mkdir data path: AE ...
    mkdir data path: AF ...
    mkdir data path: B0 ...
    mkdir data path: B1 ...
    mkdir data path: B2 ...
    mkdir data path: B3 ...
    mkdir data path: B4 ...
    mkdir data path: B5 ...
    mkdir data path: B6 ...
    mkdir data path: B7 ...
    mkdir data path: B8 ...
    mkdir data path: B9 ...
    mkdir data path: BA ...
    mkdir data path: BB ...
    mkdir data path: BC ...
    mkdir data path: BD ...
    mkdir data path: BE ...
    mkdir data path: BF ...
    mkdir data path: C0 ...
    mkdir data path: C1 ...
    mkdir data path: C2 ...
    mkdir data path: C3 ...
    mkdir data path: C4 ...
    mkdir data path: C5 ...
    mkdir data path: C6 ...
    mkdir data path: C7 ...
    mkdir data path: C8 ...
    mkdir data path: C9 ...
    mkdir data path: CA ...
    mkdir data path: CB ...
    mkdir data path: CC ...
    mkdir data path: CD ...
    mkdir data path: CE ...
    mkdir data path: CF ...
    mkdir data path: D0 ...
    mkdir data path: D1 ...
    mkdir data path: D2 ...
    mkdir data path: D3 ...
    mkdir data path: D4 ...
    mkdir data path: D5 ...
    mkdir data path: D6 ...
    mkdir data path: D7 ...
    mkdir data path: D8 ...
    mkdir data path: D9 ...
    mkdir data path: DA ...
    mkdir data path: DB ...
    mkdir data path: DC ...
    mkdir data path: DD ...
    mkdir data path: DE ...
    mkdir data path: DF ...
    mkdir data path: E0 ...
    mkdir data path: E1 ...
    mkdir data path: E2 ...
    mkdir data path: E3 ...
    mkdir data path: E4 ...
    mkdir data path: E5 ...
    mkdir data path: E6 ...
    mkdir data path: E7 ...
    mkdir data path: E8 ...
    mkdir data path: E9 ...
    mkdir data path: EA ...
    mkdir data path: EB ...
    mkdir data path: EC ...
    mkdir data path: ED ...
    mkdir data path: EE ...
    mkdir data path: EF ...
    mkdir data path: F0 ...
    mkdir data path: F1 ...
    mkdir data path: F2 ...
    mkdir data path: F3 ...
    mkdir data path: F4 ...
    mkdir data path: F5 ...
    mkdir data path: F6 ...
    mkdir data path: F7 ...
    mkdir data path: F8 ...
    mkdir data path: F9 ...
    mkdir data path: FA ...
    mkdir data path: FB ...
    mkdir data path: FC ...
    mkdir data path: FD ...
    mkdir data path: FE ...
    mkdir data path: FF ...
    data path: /srv/fastdfs/storage/data, mkdir sub dir done.
    [2017-06-30 14:35:47] INFO - file: storage_param_getter.c, line: 191, use_storage_id=0, id_type_in_filename=ip, storage_ip_changed_auto_adjust=1, store_path=0, reserved_storage_space=10.00%, use_trunk_file=0, slot_min_size=256, slot_max_size=16 MB, trunk_file_size=64 MB, trunk_create_file_advance=0, trunk_create_file_time_base=02:00, trunk_create_file_interval=86400, trunk_create_file_space_threshold=20 GB, trunk_init_check_occupying=0, trunk_init_reload_from_binlog=0, trunk_compress_binlog_min_interval=0, store_slave_file_use_link=0
    [2017-06-30 14:35:47] INFO - file: storage_func.c, line: 257, tracker_client_ip: 172.23.31.105, my_server_id_str: 172.23.31.105, g_server_id_in_filename: 1763645356
    [2017-06-30 14:35:47] INFO - file: tracker_client_thread.c, line: 310, successfully connect to tracker server 172.23.31.105:22122, as a tracker client, my ip is 172.23.31.105
    [2017-06-30 14:36:17] INFO - file: tracker_client_thread.c, line: 1263, tracker server 172.23.31.105:22122, set tracker leader: 172.23.31.105:22122
    [root@dev02 fastdfs]# 

    验证storage是否登记到tracker服务器~

    使用/usr/bin/fdfs_monitor /etc/fdfs/storage.conf,运行fdfs_monitor查看storage服务器是否已经登记到tracker服务器。

    如果出现ip_addr = <IP> Active, 则表明storage服务器已经登记到tracker服务器~

        Storage 1:
            id = 192.168.0.1
            ip_addr = 192.168.0.1  ACTIVE

    [root@dev02 fastdfs]# /usr/bin/fdfs_monitor /etc/fdfs/storage.conf
    [2017-06-30 14:40:05] DEBUG - base_path=/srv/fastdfs/storage, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0
    
    server_count=1, server_index=0
    
    tracker server is <IP_ADDRESS>:22122
    
    group count: 1
    
    Group 1:
    group name = group1
    disk total space = 25570 MB
    disk free space = 20192 MB
    trunk free space = 0 MB
    storage server count = 1
    active server count = 1
    storage server port = 23000
    storage HTTP port = 8090
    store path count = 1
    subdir count per path = 256
    current write server index = 0
    current trunk file id = 0
    
    	Storage 1:
    		id = <IP_ADDRESS>
    		ip_addr = <IP_ADDRESS>  ACTIVE
    		http domain = 
    		version = 5.11
    		join time = 2017-06-30 14:35:43
    		up time = 2017-06-30 14:35:43
    		total storage = 25570 MB
    		free storage = 20192 MB
    		upload priority = 10
    		store_path_count = 1
    		subdir_count_per_path = 256
    		storage_port = 23000
    		storage_http_port = 8090
    		current_write_path = 0
    		source storage id = 
    		if_trunk_server = 0
    		connection.alloc_count = 256
    		connection.current_count = 0
    		connection.max_count = 0
    		total_upload_count = 0
    		success_upload_count = 0
    		total_append_count = 0
    		success_append_count = 0
    		total_modify_count = 0
    		success_modify_count = 0
    		total_truncate_count = 0
    		success_truncate_count = 0
    		total_set_meta_count = 0
    		success_set_meta_count = 0
    		total_delete_count = 0
    		success_delete_count = 0
    		total_download_count = 0
    		success_download_count = 0
    		total_get_meta_count = 0
    		success_get_meta_count = 0
    		total_create_link_count = 0
    		success_create_link_count = 0
    		total_delete_link_count = 0
    		success_delete_link_count = 0
    		total_upload_bytes = 0
    		success_upload_bytes = 0
    		total_append_bytes = 0
    		success_append_bytes = 0
    		total_modify_bytes = 0
    		success_modify_bytes = 0
    		stotal_download_bytes = 0
    		success_download_bytes = 0
    		total_sync_in_bytes = 0
    		success_sync_in_bytes = 0
    		total_sync_out_bytes = 0
    		success_sync_out_bytes = 0
    		total_file_open_count = 0
    		success_file_open_count = 0
    		total_file_read_count = 0
    		success_file_read_count = 0
    		total_file_write_count = 0
    		success_file_write_count = 0
    		last_heart_beat_time = 2017-06-30 14:39:47
    		last_source_update = 1970-01-01 08:00:00
    		last_sync_update = 1970-01-01 08:00:00
    		last_synced_timestamp = 1970-01-01 08:00:00 
    [root@dev02 fastdfs]#

    至此,tracker、storage等配置都完成并成功启动~

    接下来,继续完成Nginx和fastdfs-nginx-module的安装和配置~

    Nginx和fastdfs-nginx-module安装

    下载 & 解压

    使用

    wget https://github.com/happyfish100/fastdfs-nginx-module/archive/master.zip

    下载fastdfs-nginx-module安装包~

    [root@dev02 srv]#  wget https://github.com/happyfish100/fastdfs-nginx-module/archive/master.zip
    --2017-07-03 09:55:30--  https://github.com/happyfish100/fastdfs-nginx-module/archive/master.zip
    Resolving github.com... 192.30.255.113, 192.30.255.112
    Connecting to github.com|192.30.255.113|:443... connected.
    HTTP request sent, awaiting response... 302 Found
    Location: https://codeload.github.com/happyfish100/fastdfs-nginx-module/zip/master [following]
    --2017-07-03 09:55:31--  https://codeload.github.com/happyfish100/fastdfs-nginx-module/zip/master
    Resolving codeload.github.com... 192.30.255.120, 192.30.255.121
    Connecting to codeload.github.com|192.30.255.120|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: unspecified [application/zip]
    Saving to: “master.zip”
    
        [  <=>                                                                                                                                                                                                                                ] 22,192      94.4K/s   in 0.2s    
    
    2017-07-03 09:55:32 (94.4 KB/s) - “master.zip” saved [22192]
    
    [root@dev02 srv]# 
    

    解压master.zip文件~

    [root@dev02 srv]# unzip master.zip
    Archive:  master.zip
    85347be190dcfe9d46bd67176f84afaa32718142
       creating: fastdfs-nginx-module-master/
      inflating: fastdfs-nginx-module-master/HISTORY  
      inflating: fastdfs-nginx-module-master/INSTALL  
       creating: fastdfs-nginx-module-master/src/
      inflating: fastdfs-nginx-module-master/src/common.c  
      inflating: fastdfs-nginx-module-master/src/common.h  
      inflating: fastdfs-nginx-module-master/src/config  
      inflating: fastdfs-nginx-module-master/src/mod_fastdfs.conf  
      inflating: fastdfs-nginx-module-master/src/ngx_http_fastdfs_module.c  
    [root@dev02 srv]# 
    

    解压以后可以看到一个名为 fastdfs-nginx-module-master的目录~

    下载Nginx安装包

    可以从【https://nginx.org/en/download.html】下载nginx安装包~

    本文使用的版本为nginx-1.0.15.tar.gz

    [root@dev02 srv]# wget https://nginx.org/download/nginx-1.0.15.tar.gz
    --2017-07-03 10:33:51--  https://nginx.org/download/nginx-1.0.15.tar.gz
    Resolving nginx.org... 206.251.255.63, 95.211.80.227, 2606:7100:1:69::3f, ...
    Connecting to nginx.org|206.251.255.63|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 693025 (677K) [application/octet-stream]
    Saving to: “nginx-1.0.15.tar.gz”
    
    100%[====================================================================================================================================================================================================================================>] 693,025      366K/s   in 1.8s    
    
    2017-07-03 10:33:54 (366 KB/s) - “nginx-1.0.15.tar.gz” saved [693025/693025]
    
    [root@dev02 srv]# 
    

    解压Nginx安装包

    [root@dev02 srv]# tar -zvxf nginx-1.0.15.tar.gz 
    nginx-1.0.15
    nginx-1.0.15/contrib
    nginx-1.0.15/conf
    nginx-1.0.15/src
    nginx-1.0.15/auto
    nginx-1.0.15/configure
    nginx-1.0.15/LICENSE
    nginx-1.0.15/README
    nginx-1.0.15/html
    nginx-1.0.15/man
    nginx-1.0.15/CHANGES.ru
    nginx-1.0.15/CHANGES
    nginx-1.0.15/man/nginx.8
    nginx-1.0.15/html/50x.html
    nginx-1.0.15/html/index.html
    nginx-1.0.15/auto/os
    nginx-1.0.15/auto/cc
    nginx-1.0.15/auto/nohave
    nginx-1.0.15/auto/types
    nginx-1.0.15/auto/unix
    nginx-1.0.15/auto/sources
    nginx-1.0.15/auto/have
    nginx-1.0.15/auto/include
    nginx-1.0.15/auto/define
    nginx-1.0.15/auto/feature
    nginx-1.0.15/auto/options
    nginx-1.0.15/auto/summary
    nginx-1.0.15/auto/stubs
    nginx-1.0.15/auto/init
    nginx-1.0.15/auto/lib
    nginx-1.0.15/auto/install
    nginx-1.0.15/auto/modules
    nginx-1.0.15/auto/endianess
    nginx-1.0.15/auto/headers
    nginx-1.0.15/auto/make
    nginx-1.0.15/auto/have_headers
    nginx-1.0.15/auto/lib/zlib
    nginx-1.0.15/auto/lib/test
    nginx-1.0.15/auto/lib/libgd
    nginx-1.0.15/auto/lib/libxslt
    nginx-1.0.15/auto/lib/perl
    nginx-1.0.15/auto/lib/geoip
    nginx-1.0.15/auto/lib/libatomic
    nginx-1.0.15/auto/lib/openssl
    nginx-1.0.15/auto/lib/md5
    nginx-1.0.15/auto/lib/conf
    nginx-1.0.15/auto/lib/google-perftools
    nginx-1.0.15/auto/lib/pcre
    nginx-1.0.15/auto/lib/sha1
    nginx-1.0.15/auto/lib/make
    nginx-1.0.15/auto/lib/sha1/makefile.bcc
    nginx-1.0.15/auto/lib/sha1/makefile.msvc
    nginx-1.0.15/auto/lib/sha1/makefile.owc
    nginx-1.0.15/auto/lib/sha1/conf
    nginx-1.0.15/auto/lib/sha1/make
    nginx-1.0.15/auto/lib/pcre/makefile.bcc
    nginx-1.0.15/auto/lib/pcre/makefile.msvc
    nginx-1.0.15/auto/lib/pcre/makefile.owc
    nginx-1.0.15/auto/lib/pcre/conf
    nginx-1.0.15/auto/lib/pcre/make
    nginx-1.0.15/auto/lib/google-perftools/conf
    nginx-1.0.15/auto/lib/md5/makefile.bcc
    nginx-1.0.15/auto/lib/md5/makefile.msvc
    nginx-1.0.15/auto/lib/md5/makefile.owc
    nginx-1.0.15/auto/lib/md5/conf
    nginx-1.0.15/auto/lib/md5/make
    nginx-1.0.15/auto/lib/openssl/makefile.bcc
    nginx-1.0.15/auto/lib/openssl/makefile.msvc
    nginx-1.0.15/auto/lib/openssl/conf
    nginx-1.0.15/auto/lib/openssl/make
    nginx-1.0.15/auto/lib/libatomic/conf
    nginx-1.0.15/auto/lib/libatomic/make
    nginx-1.0.15/auto/lib/geoip/conf
    nginx-1.0.15/auto/lib/perl/conf
    nginx-1.0.15/auto/lib/perl/make
    nginx-1.0.15/auto/lib/libxslt/conf
    nginx-1.0.15/auto/lib/libgd/conf
    nginx-1.0.15/auto/lib/zlib/makefile.bcc
    nginx-1.0.15/auto/lib/zlib/makefile.msvc
    nginx-1.0.15/auto/lib/zlib/makefile.owc
    nginx-1.0.15/auto/lib/zlib/patch.zlib.h
    nginx-1.0.15/auto/lib/zlib/conf
    nginx-1.0.15/auto/lib/zlib/make
    nginx-1.0.15/auto/types/sizeof
    nginx-1.0.15/auto/types/typedef
    nginx-1.0.15/auto/types/uintptr_t
    nginx-1.0.15/auto/types/value
    nginx-1.0.15/auto/cc/name
    nginx-1.0.15/auto/cc/conf
    nginx-1.0.15/auto/cc/acc
    nginx-1.0.15/auto/cc/bcc
    nginx-1.0.15/auto/cc/ccc
    nginx-1.0.15/auto/cc/msvc
    nginx-1.0.15/auto/cc/owc
    nginx-1.0.15/auto/cc/sunc
    nginx-1.0.15/auto/cc/gcc
    nginx-1.0.15/auto/cc/icc
    nginx-1.0.15/auto/os/linux
    nginx-1.0.15/auto/os/win32
    nginx-1.0.15/auto/os/darwin
    nginx-1.0.15/auto/os/conf
    nginx-1.0.15/auto/os/freebsd
    nginx-1.0.15/auto/os/solaris
    nginx-1.0.15/src/http
    nginx-1.0.15/src/event
    nginx-1.0.15/src/os
    nginx-1.0.15/src/mail
    nginx-1.0.15/src/core
    nginx-1.0.15/src/misc
    nginx-1.0.15/src/misc/ngx_cpp_test_module.cpp
    nginx-1.0.15/src/misc/ngx_google_perftools_module.c
    nginx-1.0.15/src/core/ngx_spinlock.c
    nginx-1.0.15/src/core/ngx_hash.c
    nginx-1.0.15/src/core/ngx_array.h
    nginx-1.0.15/src/core/ngx_open_file_cache.c
    nginx-1.0.15/src/core/ngx_conf_file.c
    nginx-1.0.15/src/core/ngx_md5.c
    nginx-1.0.15/src/core/ngx_radix_tree.c
    nginx-1.0.15/src/core/ngx_hash.h
    nginx-1.0.15/src/core/ngx_open_file_cache.h
    nginx-1.0.15/src/core/ngx_conf_file.h
    nginx-1.0.15/src/core/ngx_md5.h
    nginx-1.0.15/src/core/ngx_radix_tree.h
    nginx-1.0.15/src/core/ngx_core.h
    nginx-1.0.15/src/core/ngx_connection.c
    nginx-1.0.15/src/core/ngx_output_chain.c
    nginx-1.0.15/src/core/ngx_cpuinfo.c
    nginx-1.0.15/src/core/ngx_connection.h
    nginx-1.0.15/src/core/nginx.c
    nginx-1.0.15/src/core/ngx_regex.c
    nginx-1.0.15/src/core/ngx_parse.c
    nginx-1.0.15/src/core/ngx_palloc.c
    nginx-1.0.15/src/core/ngx_list.c
    nginx-1.0.15/src/core/ngx_buf.c
    nginx-1.0.15/src/core/nginx.h
    nginx-1.0.15/src/core/ngx_regex.h
    nginx-1.0.15/src/core/ngx_parse.h
    nginx-1.0.15/src/core/ngx_palloc.h
    nginx-1.0.15/src/core/ngx_file.c
    nginx-1.0.15/src/core/ngx_list.h
    nginx-1.0.15/src/core/ngx_slab.c
    nginx-1.0.15/src/core/ngx_buf.h
    nginx-1.0.15/src/core/ngx_log.c
    nginx-1.0.15/src/core/ngx_times.c
    nginx-1.0.15/src/core/ngx_rbtree.c
    nginx-1.0.15/src/core/ngx_file.h
    nginx-1.0.15/src/core/ngx_queue.c
    nginx-1.0.15/src/core/ngx_log.h
    nginx-1.0.15/src/core/ngx_slab.h
    nginx-1.0.15/src/core/ngx_times.h
    nginx-1.0.15/src/core/ngx_rbtree.h
    nginx-1.0.15/src/core/ngx_queue.h
    nginx-1.0.15/src/core/ngx_murmurhash.c
    nginx-1.0.15/src/core/ngx_inet.c
    nginx-1.0.15/src/core/ngx_cycle.c
    nginx-1.0.15/src/core/ngx_murmurhash.h
    nginx-1.0.15/src/core/ngx_crypt.c
    nginx-1.0.15/src/core/ngx_resolver.c
    nginx-1.0.15/src/core/ngx_sha1.h
    nginx-1.0.15/src/core/ngx_shmtx.c
    nginx-1.0.15/src/core/ngx_inet.h
    nginx-1.0.15/src/core/ngx_cycle.h
    nginx-1.0.15/src/core/ngx_crypt.h
    nginx-1.0.15/src/core/ngx_resolver.h
    nginx-1.0.15/src/core/ngx_string.c
    nginx-1.0.15/src/core/ngx_shmtx.h
    nginx-1.0.15/src/core/ngx_config.h
    nginx-1.0.15/src/core/ngx_string.h
    nginx-1.0.15/src/core/ngx_crc.h
    nginx-1.0.15/src/core/ngx_crc32.c
    nginx-1.0.15/src/core/ngx_array.c
    nginx-1.0.15/src/core/ngx_crc32.h
    nginx-1.0.15/src/mail/ngx_mail.c
    nginx-1.0.15/src/mail/ngx_mail_smtp_handler.c
    nginx-1.0.15/src/mail/ngx_mail_imap_handler.c
    nginx-1.0.15/src/mail/ngx_mail.h
    nginx-1.0.15/src/mail/ngx_mail_pop3_module.c
    nginx-1.0.15/src/mail/ngx_mail_proxy_module.c
    nginx-1.0.15/src/mail/ngx_mail_smtp_module.c
    nginx-1.0.15/src/mail/ngx_mail_imap_module.c
    nginx-1.0.15/src/mail/ngx_mail_pop3_module.h
    nginx-1.0.15/src/mail/ngx_mail_core_module.c
    nginx-1.0.15/src/mail/ngx_mail_smtp_module.h
    nginx-1.0.15/src/mail/ngx_mail_imap_module.h
    nginx-1.0.15/src/mail/ngx_mail_auth_http_module.c
    nginx-1.0.15/src/mail/ngx_mail_ssl_module.c
    nginx-1.0.15/src/mail/ngx_mail_parse.c
    nginx-1.0.15/src/mail/ngx_mail_ssl_module.h
    nginx-1.0.15/src/mail/ngx_mail_handler.c
    nginx-1.0.15/src/mail/ngx_mail_pop3_handler.c
    nginx-1.0.15/src/os/unix
    nginx-1.0.15/src/os/unix/ngx_aio_write.c
    nginx-1.0.15/src/os/unix/ngx_linux_init.c
    nginx-1.0.15/src/os/unix/ngx_recv.c
    nginx-1.0.15/src/os/unix/ngx_file_aio_read.c
    nginx-1.0.15/src/os/unix/ngx_udp_recv.c
    nginx-1.0.15/src/os/unix/ngx_linux_sendfile_chain.c
    nginx-1.0.15/src/os/unix/ngx_thread.h
    nginx-1.0.15/src/os/unix/rfork_thread.S
    nginx-1.0.15/src/os/unix/ngx_freebsd.h
    nginx-1.0.15/src/os/unix/ngx_writev_chain.c
    nginx-1.0.15/src/os/unix/ngx_linux_aio_read.c
    nginx-1.0.15/src/os/unix/ngx_freebsd_sendfile_chain.c
    nginx-1.0.15/src/os/unix/ngx_errno.c
    nginx-1.0.15/src/os/unix/ngx_posix_init.c
    nginx-1.0.15/src/os/unix/ngx_gcc_atomic_amd64.h
    nginx-1.0.15/src/os/unix/ngx_socket.c
    nginx-1.0.15/src/os/unix/ngx_errno.h
    nginx-1.0.15/src/os/unix/ngx_sunpro_atomic_sparc64.h
    nginx-1.0.15/src/os/unix/ngx_alloc.c
    nginx-1.0.15/src/os/unix/ngx_posix_config.h
    nginx-1.0.15/src/os/unix/ngx_socket.h
    nginx-1.0.15/src/os/unix/ngx_process_cycle.c
    nginx-1.0.15/src/os/unix/ngx_darwin_sendfile_chain.c
    nginx-1.0.15/src/os/unix/ngx_alloc.h
    nginx-1.0.15/src/os/unix/ngx_gcc_atomic_sparc64.h
    nginx-1.0.15/src/os/unix/ngx_process_cycle.h
    nginx-1.0.15/src/os/unix/ngx_linux.h
    nginx-1.0.15/src/os/unix/ngx_channel.c
    nginx-1.0.15/src/os/unix/ngx_sunpro_sparc64.il
    nginx-1.0.15/src/os/unix/ngx_sunpro_x86.il
    nginx-1.0.15/src/os/unix/ngx_channel.h
    nginx-1.0.15/src/os/unix/ngx_process.c
    nginx-1.0.15/src/os/unix/ngx_user.c
    nginx-1.0.15/src/os/unix/ngx_setproctitle.c
    nginx-1.0.15/src/os/unix/ngx_user.h
    nginx-1.0.15/src/os/unix/ngx_process.h
    nginx-1.0.15/src/os/unix/ngx_os.h
    nginx-1.0.15/src/os/unix/ngx_setproctitle.h
    nginx-1.0.15/src/os/unix/ngx_linux_config.h
    nginx-1.0.15/src/os/unix/ngx_send.c
    nginx-1.0.15/src/os/unix/ngx_freebsd_init.c
    nginx-1.0.15/src/os/unix/ngx_time.c
    nginx-1.0.15/src/os/unix/ngx_solaris_init.c
    nginx-1.0.15/src/os/unix/ngx_gcc_atomic_x86.h
    nginx-1.0.15/src/os/unix/ngx_files.c
    nginx-1.0.15/src/os/unix/ngx_aio_read.c
    nginx-1.0.15/src/os/unix/ngx_readv_chain.c
    nginx-1.0.15/src/os/unix/ngx_sunpro_amd64.il
    nginx-1.0.15/src/os/unix/ngx_time.h
    nginx-1.0.15/src/os/unix/ngx_freebsd_config.h
    nginx-1.0.15/src/os/unix/ngx_solaris_config.h
    nginx-1.0.15/src/os/unix/ngx_files.h
    nginx-1.0.15/src/os/unix/ngx_darwin_init.c
    nginx-1.0.15/src/os/unix/ngx_solaris_sendfilev_chain.c
    nginx-1.0.15/src/os/unix/ngx_darwin_config.h
    nginx-1.0.15/src/os/unix/ngx_atomic.h
    nginx-1.0.15/src/os/unix/ngx_solaris.h
    nginx-1.0.15/src/os/unix/ngx_aio_write_chain.c
    nginx-1.0.15/src/os/unix/ngx_darwin.h
    nginx-1.0.15/src/os/unix/ngx_gcc_atomic_ppc.h
    nginx-1.0.15/src/os/unix/ngx_daemon.c
    nginx-1.0.15/src/os/unix/ngx_freebsd_rfork_thread.c
    nginx-1.0.15/src/os/unix/ngx_aio_read_chain.c
    nginx-1.0.15/src/os/unix/ngx_shmem.c
    nginx-1.0.15/src/os/unix/ngx_freebsd_rfork_thread.h
    nginx-1.0.15/src/os/unix/ngx_shmem.h
    nginx-1.0.15/src/os/unix/ngx_pthread_thread.c
    nginx-1.0.15/src/event/modules
    nginx-1.0.15/src/event/ngx_event_openssl.c
    nginx-1.0.15/src/event/ngx_event_timer.h
    nginx-1.0.15/src/event/ngx_event.h
    nginx-1.0.15/src/event/ngx_event_openssl.h
    nginx-1.0.15/src/event/ngx_event_connect.c
    nginx-1.0.15/src/event/ngx_event_busy_lock.c
    nginx-1.0.15/src/event/ngx_event_pipe.c
    nginx-1.0.15/src/event/ngx_event_connect.h
    nginx-1.0.15/src/event/ngx_event_posted.c
    nginx-1.0.15/src/event/ngx_event_accept.c
    nginx-1.0.15/src/event/ngx_event_busy_lock.h
    nginx-1.0.15/src/event/ngx_event_mutex.c
    nginx-1.0.15/src/event/ngx_event_pipe.h
    nginx-1.0.15/src/event/ngx_event_posted.h
    nginx-1.0.15/src/event/ngx_event.c
    nginx-1.0.15/src/event/ngx_event_timer.c
    nginx-1.0.15/src/event/modules/ngx_kqueue_module.c
    nginx-1.0.15/src/event/modules/ngx_select_module.c
    nginx-1.0.15/src/event/modules/ngx_win32_select_module.c
    nginx-1.0.15/src/event/modules/ngx_devpoll_module.c
    nginx-1.0.15/src/event/modules/ngx_eventport_module.c
    nginx-1.0.15/src/event/modules/ngx_poll_module.c
    nginx-1.0.15/src/event/modules/ngx_aio_module.c
    nginx-1.0.15/src/event/modules/ngx_rtsig_module.c
    nginx-1.0.15/src/event/modules/ngx_epoll_module.c
    nginx-1.0.15/src/http/modules
    nginx-1.0.15/src/http/ngx_http_copy_filter_module.c
    nginx-1.0.15/src/http/ngx_http.h
    nginx-1.0.15/src/http/ngx_http_parse_time.c
    nginx-1.0.15/src/http/ngx_http_request.c
    nginx-1.0.15/src/http/ngx_http_busy_lock.c
    nginx-1.0.15/src/http/ngx_http_request.h
    nginx-1.0.15/src/http/ngx_http_core_module.c
    nginx-1.0.15/src/http/ngx_http_special_response.c
    nginx-1.0.15/src/http/ngx_http_busy_lock.h
    nginx-1.0.15/src/http/ngx_http_upstream_round_robin.c
    nginx-1.0.15/src/http/ngx_http_upstream.c
    nginx-1.0.15/src/http/ngx_http_core_module.h
    nginx-1.0.15/src/http/ngx_http_file_cache.c
    nginx-1.0.15/src/http/ngx_http_header_filter_module.c
    nginx-1.0.15/src/http/ngx_http_write_filter_module.c
    nginx-1.0.15/src/http/ngx_http_script.c
    nginx-1.0.15/src/http/ngx_http_request_body.c
    nginx-1.0.15/src/http/ngx_http_upstream.h
    nginx-1.0.15/src/http/ngx_http_upstream_round_robin.h
    nginx-1.0.15/src/http/ngx_http_cache.h
    nginx-1.0.15/src/http/ngx_http_variables.c
    nginx-1.0.15/src/http/ngx_http_script.h
    nginx-1.0.15/src/http/ngx_http_parse.c
    nginx-1.0.15/src/http/ngx_http_config.h
    nginx-1.0.15/src/http/ngx_http_variables.h
    nginx-1.0.15/src/http/ngx_http.c
    nginx-1.0.15/src/http/ngx_http_postpone_filter_module.c
    nginx-1.0.15/src/http/modules/perl
    nginx-1.0.15/src/http/modules/ngx_http_gzip_filter_module.c
    nginx-1.0.15/src/http/modules/ngx_http_gzip_static_module.c
    nginx-1.0.15/src/http/modules/ngx_http_rewrite_module.c
    nginx-1.0.15/src/http/modules/ngx_http_log_module.c
    nginx-1.0.15/src/http/modules/ngx_http_empty_gif_module.c
    nginx-1.0.15/src/http/modules/ngx_http_referer_module.c
    nginx-1.0.15/src/http/modules/ngx_http_upstream_ip_hash_module.c
    nginx-1.0.15/src/http/modules/ngx_http_sub_filter_module.c
    nginx-1.0.15/src/http/modules/ngx_http_xslt_filter_module.c
    nginx-1.0.15/src/http/modules/ngx_http_mp4_module.c
    nginx-1.0.15/src/http/modules/ngx_http_addition_filter_module.c
    nginx-1.0.15/src/http/modules/ngx_http_access_module.c
    nginx-1.0.15/src/http/modules/ngx_http_ssl_module.c
    nginx-1.0.15/src/http/modules/ngx_http_secure_link_module.c
    nginx-1.0.15/src/http/modules/ngx_http_ssi_filter_module.c
    nginx-1.0.15/src/http/modules/ngx_http_ssl_module.h
    nginx-1.0.15/src/http/modules/ngx_http_memcached_module.c
    nginx-1.0.15/src/http/modules/ngx_http_index_module.c
    nginx-1.0.15/src/http/modules/ngx_http_random_index_module.c
    nginx-1.0.15/src/http/modules/ngx_http_ssi_filter_module.h
    nginx-1.0.15/src/http/modules/ngx_http_limit_zone_module.c
    nginx-1.0.15/src/http/modules/ngx_http_geo_module.c
    nginx-1.0.15/src/http/modules/ngx_http_dav_module.c
    nginx-1.0.15/src/http/modules/ngx_http_split_clients_module.c
    nginx-1.0.15/src/http/modules/ngx_http_realip_module.c
    nginx-1.0.15/src/http/modules/ngx_http_stub_status_module.c
    nginx-1.0.15/src/http/modules/ngx_http_fastcgi_module.c
    nginx-1.0.15/src/http/modules/ngx_http_headers_filter_module.c
    nginx-1.0.15/src/http/modules/ngx_http_degradation_module.c
    nginx-1.0.15/src/http/modules/ngx_http_proxy_module.c
    nginx-1.0.15/src/http/modules/ngx_http_browser_module.c
    nginx-1.0.15/src/http/modules/ngx_http_limit_req_module.c
    nginx-1.0.15/src/http/modules/ngx_http_scgi_module.c
    nginx-1.0.15/src/http/modules/ngx_http_chunked_filter_module.c
    nginx-1.0.15/src/http/modules/ngx_http_image_filter_module.c
    nginx-1.0.15/src/http/modules/ngx_http_flv_module.c
    nginx-1.0.15/src/http/modules/ngx_http_static_module.c
    nginx-1.0.15/src/http/modules/ngx_http_charset_filter_module.c
    nginx-1.0.15/src/http/modules/ngx_http_uwsgi_module.c
    nginx-1.0.15/src/http/modules/ngx_http_autoindex_module.c
    nginx-1.0.15/src/http/modules/ngx_http_userid_filter_module.c
    nginx-1.0.15/src/http/modules/ngx_http_range_filter_module.c
    nginx-1.0.15/src/http/modules/ngx_http_auth_basic_module.c
    nginx-1.0.15/src/http/modules/ngx_http_geoip_module.c
    nginx-1.0.15/src/http/modules/ngx_http_not_modified_filter_module.c
    nginx-1.0.15/src/http/modules/ngx_http_map_module.c
    nginx-1.0.15/src/http/modules/perl/typemap
    nginx-1.0.15/src/http/modules/perl/ngx_http_perl_module.c
    nginx-1.0.15/src/http/modules/perl/Makefile.PL
    nginx-1.0.15/src/http/modules/perl/ngx_http_perl_module.h
    nginx-1.0.15/src/http/modules/perl/nginx.xs
    nginx-1.0.15/src/http/modules/perl/nginx.pm
    nginx-1.0.15/conf/uwsgi_params
    nginx-1.0.15/conf/fastcgi_params
    nginx-1.0.15/conf/fastcgi.conf
    nginx-1.0.15/conf/nginx.conf
    nginx-1.0.15/conf/scgi_params
    nginx-1.0.15/conf/win-utf
    nginx-1.0.15/conf/mime.types
    nginx-1.0.15/conf/koi-win
    nginx-1.0.15/conf/koi-utf
    nginx-1.0.15/contrib/unicode2nginx
    nginx-1.0.15/contrib/geo2nginx.pl
    nginx-1.0.15/contrib/README
    nginx-1.0.15/contrib/unicode2nginx/unicode-to-nginx.pl
    nginx-1.0.15/contrib/unicode2nginx/win-utf
    nginx-1.0.15/contrib/unicode2nginx/koi-utf
    [root@dev02 srv]# 

    configure

    进入nginx目录,

    [root@dev02 srv]# cd nginx-1.0.15
    [root@dev02 nginx-1.0.15]# ll
    total 528
    drwxr-xr-x 6 1001 1001   4096 Jul  3 10:35 auto
    -rw-r--r-- 1 1001 1001 198580 Apr 12  2012 CHANGES
    -rw-r--r-- 1 1001 1001 302723 Apr 12  2012 CHANGES.ru
    drwxr-xr-x 2 1001 1001   4096 Jul  3 10:35 conf
    -rwxr-xr-x 1 1001 1001   2345 Feb  6  2012 configure
    drwxr-xr-x 3 1001 1001   4096 Jul  3 10:35 contrib
    drwxr-xr-x 2 1001 1001   4096 Jul  3 10:35 html
    -rw-r--r-- 1 1001 1001   1365 Feb  6  2012 LICENSE
    drwxr-xr-x 2 1001 1001   4096 Jul  3 10:35 man
    -rw-r--r-- 1 1001 1001     49 Nov  1  2011 README
    drwxr-xr-x 8 1001 1001   4096 Jul  3 10:35 src
    [root@dev02 nginx-1.0.15]# 

    安装nginx的时候,添加 fastdfs-nginx-module-master模块,如:

     ./configure --add-module=../fastdfs-nginx-module-master/src/

    如:

    [root@dev02 nginx-1.0.15]# ./configure --add-module=../fastdfs-nginx-module-master/src/
    checking for OS
     + Linux 2.6.32-573.el6.x86_64 x86_64
    checking for C compiler ... found
     + using GNU C compiler
     + gcc version: 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) 
    checking for gcc -pipe switch ... found
    checking for gcc builtin atomic operations ... found
    checking for C99 variadic macros ... found
    checking for gcc variadic macros ... found
    checking for unistd.h ... found
    checking for inttypes.h ... found
    checking for limits.h ... found
    checking for sys/filio.h ... not found
    checking for sys/param.h ... found
    checking for sys/mount.h ... found
    checking for sys/statvfs.h ... found
    checking for crypt.h ... found
    checking for Linux specific features
    checking for epoll ... found
    checking for sendfile() ... found
    checking for sendfile64() ... found
    checking for sys/prctl.h ... found
    checking for prctl(PR_SET_DUMPABLE) ... found
    checking for sched_setaffinity() ... found
    checking for crypt_r() ... found
    checking for sys/vfs.h ... found
    checking for nobody group ... found
    checking for poll() ... found
    checking for /dev/poll ... not found
    checking for kqueue ... not found
    checking for crypt() ... not found
    checking for crypt() in libcrypt ... found
    checking for F_READAHEAD ... not found
    checking for posix_fadvise() ... found
    checking for O_DIRECT ... found
    checking for F_NOCACHE ... not found
    checking for directio() ... not found
    checking for statfs() ... found
    checking for statvfs() ... found
    checking for dlopen() ... not found
    checking for dlopen() in libdl ... found
    checking for sched_yield() ... found
    checking for SO_SETFIB ... not found
    checking for SO_ACCEPTFILTER ... not found
    checking for TCP_DEFER_ACCEPT ... found
    checking for accept4() ... found
    checking for int size ... 4 bytes
    checking for long size ... 8 bytes
    checking for long long size ... 8 bytes
    checking for void * size ... 8 bytes
    checking for uint64_t ... found
    checking for sig_atomic_t ... found
    checking for sig_atomic_t size ... 4 bytes
    checking for socklen_t ... found
    checking for in_addr_t ... found
    checking for in_port_t ... found
    checking for rlim_t ... found
    checking for uintptr_t ... uintptr_t found
    checking for system endianess ... little endianess
    checking for size_t size ... 8 bytes
    checking for off_t size ... 8 bytes
    checking for time_t size ... 8 bytes
    checking for setproctitle() ... not found
    checking for pread() ... found
    checking for pwrite() ... found
    checking for sys_nerr ... found
    checking for localtime_r() ... found
    checking for posix_memalign() ... found
    checking for memalign() ... found
    checking for mmap(MAP_ANON|MAP_SHARED) ... found
    checking for mmap("/dev/zero", MAP_SHARED) ... found
    checking for System V shared memory ... found
    checking for POSIX semaphores ... not found
    checking for POSIX semaphores in libpthread ... found
    checking for struct msghdr.msg_control ... found
    checking for ioctl(FIONBIO) ... found
    checking for struct tm.tm_gmtoff ... found
    checking for struct dirent.d_namlen ... not found
    checking for struct dirent.d_type ... found
    checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
    configuring additional modules
    adding module in ../fastdfs-nginx-module-master/src/
     + ngx_http_fastdfs_module was configured
    checking for PCRE library ... not found
    checking for PCRE library in /usr/local/ ... not found
    checking for PCRE library in /usr/include/pcre/ ... not found
    checking for PCRE library in /usr/pkg/ ... not found
    checking for PCRE library in /opt/local/ ... not found
    
    ./configure: error: the HTTP rewrite module requires the PCRE library.
    You can either disable the module by using --without-http_rewrite_module
    option, or install the PCRE library into the system, or build the PCRE library
    statically from the source with nginx by using --with-pcre=<path> option.
    
    [root@dev02 nginx-1.0.15]# 

    注意:

    Nginx安装需要依赖pcre库以及zlib库,

    yum -y install pcre-devel

    yum install -y zlib-devel

    所以,如果没有预先安装这些依赖库,使用./configure配置则会出现如下问题~如:

    发现错误

    
    ./configure: error: the HTTP rewrite module requires the PCRE library.
    You can either disable the module by using --without-http_rewrite_module
    option, or install the PCRE library into the system, or build the PCRE library
    statically from the source with nginx by using --with-pcre=<path> option.

    解决方法,安装pcre

    yum -y install pcre-devel

    
    [root@dev02 nginx-1.0.15]# yum -y install pcre-devel
    Loaded plugins: fastestmirror
    Setting up Install Process
    Loading mirror speeds from cached hostfile
    ISO                                                                                                                                                                                                                                                    | 4.0 kB     00:00     
    mongodb-org-3.4                                                                                                                                                                                                                                        | 2.5 kB     00:00     
    Resolving Dependencies
    --> Running transaction check
    ---> Package pcre-devel.x86_64 0:7.8-7.el6 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ==============================================================================================================================================================================================================================================================================
     Package                                                             Arch                                                            Version                                                               Repository                                                    Size
    ==============================================================================================================================================================================================================================================================================
    Installing:
     pcre-devel                                                          x86_64                                                          7.8-7.el6                                                             ISO                                                          320 k
    
    Transaction Summary
    ==============================================================================================================================================================================================================================================================================
    Install       1 Package(s)
    
    Total download size: 320 k
    Installed size: 957 k
    Downloading Packages:
    pcre-devel-7.8-7.el6.x86_64.rpm                                                                                                                                                                                                                        | 320 kB     00:00     
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing : pcre-devel-7.8-7.el6.x86_64                                                                                                                                                                                                                                1/1 
      Verifying  : pcre-devel-7.8-7.el6.x86_64                                                                                                                                                                                                                                1/1 
    
    Installed:
      pcre-devel.x86_64 0:7.8-7.el6                                                                                                                                                                                                                                               
    
    Complete!
    [root@dev02 nginx-1.0.15]# 
    

    重新configure

    [root@dev02 nginx-1.0.15]# ./configure --add-module=../fastdfs-nginx-module-master/src/
    checking for OS
     + Linux 2.6.32-573.el6.x86_64 x86_64
    checking for C compiler ... found
     + using GNU C compiler
     + gcc version: 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) 
    checking for gcc -pipe switch ... found
    checking for gcc builtin atomic operations ... found
    checking for C99 variadic macros ... found
    checking for gcc variadic macros ... found
    checking for unistd.h ... found
    checking for inttypes.h ... found
    checking for limits.h ... found
    checking for sys/filio.h ... not found
    checking for sys/param.h ... found
    checking for sys/mount.h ... found
    checking for sys/statvfs.h ... found
    checking for crypt.h ... found
    checking for Linux specific features
    checking for epoll ... found
    checking for sendfile() ... found
    checking for sendfile64() ... found
    checking for sys/prctl.h ... found
    checking for prctl(PR_SET_DUMPABLE) ... found
    checking for sched_setaffinity() ... found
    checking for crypt_r() ... found
    checking for sys/vfs.h ... found
    checking for nobody group ... found
    checking for poll() ... found
    checking for /dev/poll ... not found
    checking for kqueue ... not found
    checking for crypt() ... not found
    checking for crypt() in libcrypt ... found
    checking for F_READAHEAD ... not found
    checking for posix_fadvise() ... found
    checking for O_DIRECT ... found
    checking for F_NOCACHE ... not found
    checking for directio() ... not found
    checking for statfs() ... found
    checking for statvfs() ... found
    checking for dlopen() ... not found
    checking for dlopen() in libdl ... found
    checking for sched_yield() ... found
    checking for SO_SETFIB ... not found
    checking for SO_ACCEPTFILTER ... not found
    checking for TCP_DEFER_ACCEPT ... found
    checking for accept4() ... found
    checking for int size ... 4 bytes
    checking for long size ... 8 bytes
    checking for long long size ... 8 bytes
    checking for void * size ... 8 bytes
    checking for uint64_t ... found
    checking for sig_atomic_t ... found
    checking for sig_atomic_t size ... 4 bytes
    checking for socklen_t ... found
    checking for in_addr_t ... found
    checking for in_port_t ... found
    checking for rlim_t ... found
    checking for uintptr_t ... uintptr_t found
    checking for system endianess ... little endianess
    checking for size_t size ... 8 bytes
    checking for off_t size ... 8 bytes
    checking for time_t size ... 8 bytes
    checking for setproctitle() ... not found
    checking for pread() ... found
    checking for pwrite() ... found
    checking for sys_nerr ... found
    checking for localtime_r() ... found
    checking for posix_memalign() ... found
    checking for memalign() ... found
    checking for mmap(MAP_ANON|MAP_SHARED) ... found
    checking for mmap("/dev/zero", MAP_SHARED) ... found
    checking for System V shared memory ... found
    checking for POSIX semaphores ... not found
    checking for POSIX semaphores in libpthread ... found
    checking for struct msghdr.msg_control ... found
    checking for ioctl(FIONBIO) ... found
    checking for struct tm.tm_gmtoff ... found
    checking for struct dirent.d_namlen ... not found
    checking for struct dirent.d_type ... found
    checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
    configuring additional modules
    adding module in ../fastdfs-nginx-module-master/src/
     + ngx_http_fastdfs_module was configured
    checking for PCRE library ... found
    checking for system md library ... not found
    checking for system md5 library ... not found
    checking for OpenSSL md5 crypto library ... not found
    checking for sha1 in system md library ... not found
    checking for OpenSSL sha1 crypto library ... not found
    checking for zlib library ... not found
    
    ./configure: error: the HTTP gzip module requires the zlib library.
    You can either disable the module by using --without-http_gzip_module
    option, or install the zlib library into the system, or build the zlib library
    statically from the source with nginx by using --with-zlib=<path> option.
    
    [root@dev02 nginx-1.0.15]# 
    

    还有问题

    
    ./configure: error: the HTTP gzip module requires the zlib library.
    You can either disable the module by using --without-http_gzip_module
    option, or install the zlib library into the system, or build the zlib libr

    继续安装zlib库

    yum install -y zlib-devel

    [root@dev02 nginx-1.0.15]# yum install -y zlib-devel
    Loaded plugins: fastestmirror
    Setting up Install Process
    Loading mirror speeds from cached hostfile
    Resolving Dependencies
    --> Running transaction check
    ---> Package zlib-devel.x86_64 0:1.2.3-29.el6 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ==============================================================================================================================================================================================================================================================================
     Package                                                             Arch                                                            Version                                                               Repository                                                    Size
    ==============================================================================================================================================================================================================================================================================
    Installing:
     zlib-devel                                                          x86_64                                                          1.2.3-29.el6                                                          ISO                                                           44 k
    
    Transaction Summary
    ==============================================================================================================================================================================================================================================================================
    Install       1 Package(s)
    
    Total download size: 44 k
    Installed size: 115 k
    Downloading Packages:
    zlib-devel-1.2.3-29.el6.x86_64.rpm                                                                                                                                                                                                                     |  44 kB     00:00     
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing : zlib-devel-1.2.3-29.el6.x86_64                                                                                                                                                                                                                             1/1 
      Verifying  : zlib-devel-1.2.3-29.el6.x86_64                                                                                                                                                                                                                             1/1 
    
    Installed:
      zlib-devel.x86_64 0:1.2.3-29.el6                                                                                                                                                                                                                                            
    
    Complete!
    [root@dev02 nginx-1.0.15]# 
    

    再次configure

    [root@dev02 nginx-1.0.15]# yum install -y zlib-devel
    Loaded plugins: fastestmirror
    Setting up Install Process
    Loading mirror speeds from cached hostfile
    Resolving Dependencies
    --> Running transaction check
    ---> Package zlib-devel.x86_64 0:1.2.3-29.el6 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ==============================================================================================================================================================================================================================================================================
     Package                                                             Arch                                                            Version                                                               Repository                                                    Size
    ==============================================================================================================================================================================================================================================================================
    Installing:
     zlib-devel                                                          x86_64                                                          1.2.3-29.el6                                                          ISO                                                           44 k
    
    Transaction Summary
    ==============================================================================================================================================================================================================================================================================
    Install       1 Package(s)
    
    Total download size: 44 k
    Installed size: 115 k
    Downloading Packages:
    zlib-devel-1.2.3-29.el6.x86_64.rpm                                                                                                                                                                                                                     |  44 kB     00:00     
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing : zlib-devel-1.2.3-29.el6.x86_64                                                                                                                                                                                                                             1/1 
      Verifying  : zlib-devel-1.2.3-29.el6.x86_64                                                                                                                                                                                                                             1/1 
    
    Installed:
      zlib-devel.x86_64 0:1.2.3-29.el6                                                                                                                                                                                                                                            
    
    Complete!
    [root@dev02 nginx-1.0.15]# ./configure --add-module=../fastdfs-nginx-module-master/src/
    checking for OS
     + Linux 2.6.32-573.el6.x86_64 x86_64
    checking for C compiler ... found
     + using GNU C compiler
     + gcc version: 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) 
    checking for gcc -pipe switch ... found
    checking for gcc builtin atomic operations ... found
    checking for C99 variadic macros ... found
    checking for gcc variadic macros ... found
    checking for unistd.h ... found
    checking for inttypes.h ... found
    checking for limits.h ... found
    checking for sys/filio.h ... not found
    checking for sys/param.h ... found
    checking for sys/mount.h ... found
    checking for sys/statvfs.h ... found
    checking for crypt.h ... found
    checking for Linux specific features
    checking for epoll ... found
    checking for sendfile() ... found
    checking for sendfile64() ... found
    checking for sys/prctl.h ... found
    checking for prctl(PR_SET_DUMPABLE) ... found
    checking for sched_setaffinity() ... found
    checking for crypt_r() ... found
    checking for sys/vfs.h ... found
    checking for nobody group ... found
    checking for poll() ... found
    checking for /dev/poll ... not found
    checking for kqueue ... not found
    checking for crypt() ... not found
    checking for crypt() in libcrypt ... found
    checking for F_READAHEAD ... not found
    checking for posix_fadvise() ... found
    checking for O_DIRECT ... found
    checking for F_NOCACHE ... not found
    checking for directio() ... not found
    checking for statfs() ... found
    checking for statvfs() ... found
    checking for dlopen() ... not found
    checking for dlopen() in libdl ... found
    checking for sched_yield() ... found
    checking for SO_SETFIB ... not found
    checking for SO_ACCEPTFILTER ... not found
    checking for TCP_DEFER_ACCEPT ... found
    checking for accept4() ... found
    checking for int size ... 4 bytes
    checking for long size ... 8 bytes
    checking for long long size ... 8 bytes
    checking for void * size ... 8 bytes
    checking for uint64_t ... found
    checking for sig_atomic_t ... found
    checking for sig_atomic_t size ... 4 bytes
    checking for socklen_t ... found
    checking for in_addr_t ... found
    checking for in_port_t ... found
    checking for rlim_t ... found
    checking for uintptr_t ... uintptr_t found
    checking for system endianess ... little endianess
    checking for size_t size ... 8 bytes
    checking for off_t size ... 8 bytes
    checking for time_t size ... 8 bytes
    checking for setproctitle() ... not found
    checking for pread() ... found
    checking for pwrite() ... found
    checking for sys_nerr ... found
    checking for localtime_r() ... found
    checking for posix_memalign() ... found
    checking for memalign() ... found
    checking for mmap(MAP_ANON|MAP_SHARED) ... found
    checking for mmap("/dev/zero", MAP_SHARED) ... found
    checking for System V shared memory ... found
    checking for POSIX semaphores ... not found
    checking for POSIX semaphores in libpthread ... found
    checking for struct msghdr.msg_control ... found
    checking for ioctl(FIONBIO) ... found
    checking for struct tm.tm_gmtoff ... found
    checking for struct dirent.d_namlen ... not found
    checking for struct dirent.d_type ... found
    checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
    configuring additional modules
    adding module in ../fastdfs-nginx-module-master/src/
     + ngx_http_fastdfs_module was configured
    checking for PCRE library ... found
    checking for system md library ... not found
    checking for system md5 library ... not found
    checking for OpenSSL md5 crypto library ... not found
    checking for sha1 in system md library ... not found
    checking for OpenSSL sha1 crypto library ... not found
    checking for zlib library ... found
    creating objs/Makefile
    
    Configuration summary
      + using system PCRE library
      + OpenSSL library is not used
      + using builtin md5 code
      + sha1 library is not found
      + using system zlib library
    
      nginx path prefix: "/usr/local/nginx"
      nginx binary file: "/usr/local/nginx/sbin/nginx"
      nginx configuration prefix: "/usr/local/nginx/conf"
      nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
      nginx pid file: "/usr/local/nginx/logs/nginx.pid"
      nginx error log file: "/usr/local/nginx/logs/error.log"
      nginx http access log file: "/usr/local/nginx/logs/access.log"
      nginx http client request body temporary files: "client_body_temp"
      nginx http proxy temporary files: "proxy_temp"
      nginx http fastcgi temporary files: "fastcgi_temp"
      nginx http uwsgi temporary files: "uwsgi_temp"
      nginx http scgi temporary files: "scgi_temp"
    [root@dev02 nginx-1.0.15]# 
    

    configure成功了~ 

    接下来执行make和make install 

    make

    ake -f objs/Makefile
    make[1]: Entering directory `/srv/nginx-1.0.15'
    gcc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-function -Wunused-variable -Wunused-value -Werror -g  -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='"/etc/fdfs/mod_fastdfs.conf"' -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/include/fastdfs -I /usr/include/fastcommon/ -I objs 
    		-o objs/src/core/nginx.o 
    		src/core/nginx.c
    gcc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-function -Wunused-variable -Wunused-value -Werror -g  -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='"/etc/fdfs/mod_fastdfs.conf"' -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/include/fastdfs -I /usr/include/fastcommon/ -I objs 
    		-o objs/src/core/ngx_log.o 
    		src/core/ngx_log.c
    gcc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-function -Wunused-variable -Wunused-value -Werror -g  -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='"/etc/fdfs/mod_fastdfs.conf"' -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/include/fastdfs -I /usr/include/fastcommon/ -I objs 
    		-o objs/src/core/ngx_palloc.o 
    		src/core/ngx_palloc.c
    gcc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-function -Wunused-variable -Wunused-value -Werror -g  -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='"/etc/fdfs/mod_fastdfs.conf"' -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/include/fastdfs -I /usr/include/fastcommon/ -I objs 
    		-o objs/src/core/ngx_array.o 
    		src/core/ngx_array.c
    gcc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-function -Wunused-variable -Wunused-value -Werror -g  -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='"/etc/fdfs/mod_fastdfs.conf"' -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/include/fastdfs -I /usr/include/fastcommon/ -I objs 
    		-o objs/src/core/ngx_list.o 
    		src/core/ngx_list.c
    gcc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-function -Wunused-variable -Wunused-value -Werror -g  -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='"/etc/fdfs/mod_fastdfs.conf"' -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/include/fastdfs -I /usr/include/fastcommon/ -I objs 
    		-o objs/src/core/ngx_hash.o 
    		src/core/ngx_hash.c
    
    
    
    ... ...
    
    	objs/src/http/modules/ngx_http_ssi_filter_module.o 
    	objs/src/http/modules/ngx_http_charset_filter_module.o 
    	objs/src/http/modules/ngx_http_userid_filter_module.o 
    	objs/src/http/modules/ngx_http_autoindex_module.o 
    	objs/src/http/modules/ngx_http_auth_basic_module.o 
    	objs/src/http/modules/ngx_http_access_module.o 
    	objs/src/http/modules/ngx_http_limit_zone_module.o 
    	objs/src/http/modules/ngx_http_limit_req_module.o 
    	objs/src/http/modules/ngx_http_geo_module.o 
    	objs/src/http/modules/ngx_http_map_module.o 
    	objs/src/http/modules/ngx_http_split_clients_module.o 
    	objs/src/http/modules/ngx_http_referer_module.o 
    	objs/src/http/modules/ngx_http_rewrite_module.o 
    	objs/src/http/modules/ngx_http_proxy_module.o 
    	objs/src/http/modules/ngx_http_fastcgi_module.o 
    	objs/src/http/modules/ngx_http_uwsgi_module.o 
    	objs/src/http/modules/ngx_http_scgi_module.o 
    	objs/src/http/modules/ngx_http_memcached_module.o 
    	objs/src/http/modules/ngx_http_empty_gif_module.o 
    	objs/src/http/modules/ngx_http_browser_module.o 
    	objs/src/http/modules/ngx_http_upstream_ip_hash_module.o 
    	objs/addon/src/ngx_http_fastdfs_module.o 
    	objs/ngx_modules.o 
    	-lpthread -lcrypt -lfastcommon -lfdfsclient -lpcre -lz
    make[1]: Leaving directory `/srv/nginx-1.0.15'
    make -f objs/Makefile manpage
    make[1]: Entering directory `/srv/nginx-1.0.15'
    sed -e "s|%%PREFIX%%|/usr/local/nginx|" 
    		-e "s|%%PID_PATH%%|/usr/local/nginx/logs/nginx.pid|" 
    		-e "s|%%CONF_PATH%%|/usr/local/nginx/conf/nginx.conf|" 
    		-e "s|%%ERROR_LOG_PATH%%|/usr/local/nginx/logs/error.log|" 
    		< man/nginx.8 > objs/nginx.8
    make[1]: Leaving directory `/srv/nginx-1.0.15'
    [root@dev02 nginx-1.0.15]# 
    
    
    

    make install

    [root@dev02 nginx-1.0.15]# make install
    make -f objs/Makefile install
    make[1]: Entering directory `/srv/nginx-1.0.15'
    test -d '/usr/local/nginx' || mkdir -p '/usr/local/nginx'
    test -d '/usr/local/nginx/sbin' 		|| mkdir -p '/usr/local/nginx/sbin'
    test ! -f '/usr/local/nginx/sbin/nginx' 		|| mv '/usr/local/nginx/sbin/nginx' 			'/usr/local/nginx/sbin/nginx.old'
    cp objs/nginx '/usr/local/nginx/sbin/nginx'
    test -d '/usr/local/nginx/conf' 		|| mkdir -p '/usr/local/nginx/conf'
    cp conf/koi-win '/usr/local/nginx/conf'
    cp conf/koi-utf '/usr/local/nginx/conf'
    cp conf/win-utf '/usr/local/nginx/conf'
    test -f '/usr/local/nginx/conf/mime.types' 		|| cp conf/mime.types '/usr/local/nginx/conf'
    cp conf/mime.types '/usr/local/nginx/conf/mime.types.default'
    test -f '/usr/local/nginx/conf/fastcgi_params' 		|| cp conf/fastcgi_params '/usr/local/nginx/conf'
    cp conf/fastcgi_params 		'/usr/local/nginx/conf/fastcgi_params.default'
    test -f '/usr/local/nginx/conf/fastcgi.conf' 		|| cp conf/fastcgi.conf '/usr/local/nginx/conf'
    cp conf/fastcgi.conf '/usr/local/nginx/conf/fastcgi.conf.default'
    test -f '/usr/local/nginx/conf/uwsgi_params' 		|| cp conf/uwsgi_params '/usr/local/nginx/conf'
    cp conf/uwsgi_params 		'/usr/local/nginx/conf/uwsgi_params.default'
    test -f '/usr/local/nginx/conf/scgi_params' 		|| cp conf/scgi_params '/usr/local/nginx/conf'
    cp conf/scgi_params 		'/usr/local/nginx/conf/scgi_params.default'
    test -f '/usr/local/nginx/conf/nginx.conf' 		|| cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf'
    cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf.default'
    test -d '/usr/local/nginx/logs' 		|| mkdir -p '/usr/local/nginx/logs'
    test -d '/usr/local/nginx/logs' || 		mkdir -p '/usr/local/nginx/logs'
    test -d '/usr/local/nginx/html' 		|| cp -R html '/usr/local/nginx'
    test -d '/usr/local/nginx/logs' || 		mkdir -p '/usr/local/nginx/logs'
    make[1]: Leaving directory `/srv/nginx-1.0.15'
    [root@dev02 nginx-1.0.15]#

    安装成功,查看版本信息

    [root@dev02 nginx-1.0.15]# /usr/local/nginx/sbin/nginx -V
    nginx version: nginx/1.0.15
    built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) 
    configure arguments: --add-module=../fastdfs-nginx-module-master/src/
    [root@dev02 nginx-1.0.15]# 
    

    配置Nginx 和Fastdfs-nginx-module

    配置fastdfs-nginx-module

    进入fastdfs-nginx-module-master的src目录,如

    [root@dev02 fastdfs-nginx-module-master]# cd src
    [root@dev02 src]# ll
    total 84
    -rw-r--r-- 1 root root 43398 May 30 09:57 common.c
    -rw-r--r-- 1 root root  3987 May 30 09:57 common.h
    -rw-r--r-- 1 root root   902 May 30 09:57 config
    -rw-r--r-- 1 root root  3725 May 30 09:57 mod_fastdfs.conf
    -rw-r--r-- 1 root root 28668 May 30 09:57 ngx_http_fastdfs_module.c
    [root@dev02 src]# 
    

    md_fastdfs.conf配置文件拷贝到/etc/fdfs/目录中

    [root@dev02 src]# cp mod_fastdfs.conf /etc/fdfs/
    [root@dev02 src]# 

    进入/etc/fdfs目录,并修改mod_fastdfs.conf文件~ 

    指定storage_path0路径,storage的是服务端口,tracker服务器地址等,如

    
    # FastDFS tracker_server can ocur more than once, and tracker_server format is
    #  "host:port", host can be hostname or ip address
    # valid only when load_fdfs_parameters_from_tracker is true
    tracker_server=<IP_ADDRESS>:22122
    
    # the port of the local storage server
    # the default value is 23000
    storage_server_port=23000
    
    # the group name of the local storage server
    group_name=group1
    
    # if the url / uri including the group name
    # set to false when uri like /M00/00/00/xxx
    # set to true when uri like ${group_name}/M00/00/00/xxx, such as group1/M00/xxx
    # default value is false
    url_have_group_name = true
    
    # path(disk or mount point) count, default value is 1
    # must same as storage.conf
    store_path_count=1
    
    # store_path#, based 0, if store_path0 not exists, it's value is base_path
    # the paths must be exist
    # must same as storage.conf
    store_path0=/srv/fastdfs/storage
    

    配置好之后,进入FastDFS目录下的conf目录~本示例中目录名为fastdfs-master。

    [root@dev02 conf]# cd /srv/fastdfs-master/
    [root@dev02 fastdfs-master]# cd conf/
    [root@dev02 conf]# ll
    total 84
    -rw-rw-r-- 1 root root 23981 Jun  3 21:09 anti-steal.jpg
    -rw-rw-r-- 1 root root  1461 Jun  3 21:09 client.conf
    -rw-rw-r-- 1 root root   955 Jun  3 21:09 http.conf
    -rw-rw-r-- 1 root root 31172 Jun  3 21:09 mime.types
    -rw-rw-r-- 1 root root  7927 Jun  3 21:09 storage.conf
    -rw-rw-r-- 1 root root   105 Jun  3 21:09 storage_ids.conf
    -rw-rw-r-- 1 root root  7389 Jun  3 21:09 tracker.conf
    [root@dev02 conf]# 
    

    将还没有使用的配置文件拷贝到/etc/fdfs目录中去

    cp anti-steal.jpg http.conf mime.types /etc/fdfs/

    然后,/etc/fdfs/目录中的配置文件如下,其中带sample的文件可以删除~

    [root@dev02 conf]# cd /etc/fdfs
    [root@dev02 fdfs]# ll
    total 104
    -rw-r--r-- 1 root root 23981 Jul  3 11:18 anti-steal.jpg
    -rw-r--r-- 1 root root  1461 Jun 30 12:29 client.conf.sample
    -rw-r--r-- 1 root root   955 Jul  3 11:18 http.conf
    -rw-r--r-- 1 root root 31172 Jul  3 11:18 mime.types
    -rw-r--r-- 1 root root  3735 Jul  3 11:15 mod_fastdfs.conf
    -rw-r--r-- 1 root root  7925 Jun 30 14:33 storage.conf
    -rw-r--r-- 1 root root  7927 Jun 30 12:29 storage.conf.sample
    -rw-r--r-- 1 root root   105 Jun 30 12:29 storage_ids.conf.sample
    -rw-r--r-- 1 root root  7389 Jun 30 12:52 tracker.conf
    -rw-r--r-- 1 root root  7389 Jun 30 12:29 tracker.conf.sample
    [root@dev02 fdfs]# 

    配置Nginx

    使用 vim /usr/local/nginx/conf/nginx.conf命令,查看和修改nginx配置文件内容~

    添加 如下内容并修改Nginx服务端口为19080~

            location /group1/M00 {
                     root /srv/data/fastdfs/storage/;
                    ngx_fastdfs_module;
            }

    如:

     server {
            listen       19080;
            server_name  localhost;
    
            #charset koi8-r;
    
            #access_log  logs/host.access.log  main;
    
            location / {
                root   html;
                index  index.html index.htm;
            }
    
    
            location /group1/M00 {
                     root /srv/data/fastdfs/storage/;
                    ngx_fastdfs_module;
            }
    

    由于我们配置了group1/M00的访问,我们需要建立一个group1文件夹,并建立M00到data的软链接。

    如:

      mkdir -p /srv/fastdfs/storage/data/group1
      ln -s /srv/fastdfs/storage/data /srv/fastdfs/storage/data/group1/M00

    [root@dev02 fdfs]#  mkdir -p /srv/fastdfs/storage/data/group1
    [root@dev02 fdfs]# ln -s /srv/fastdfs/storage/data /srv/fastdfs/storage/data/group1/M00
    [root@dev02 fdfs]# 

    测试

    一切就绪之后,剩下的就需要启动Nginx并完成文件的上传等~ 查看FastDFS是否可正常使用~

    启动Nginx

    [root@dev02 ~]# /usr/local/nginx/sbin/nginx
    ngx_http_fastdfs_set pid=17650
    [root@dev02 ~]# ps -ef|grep nginx
    root     17651     1  0 12:16 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
    nobody   17652 17651  0 12:16 ?        00:00:00 nginx: worker process      
    root     17655 17631  0 12:16 pts/2    00:00:00 grep nginx
    [root@dev02 ~]# 
    

    访问http://<YOUR_IP>:<YOUR_PORT>访问Nginx,可以看到Welcome to nginx的信息就表示Nginx运行成功。

    Welcome to nginx!

    配置client.conf文件

    [root@dev02 fdfs]# cp client.conf.sample client.conf
    [root@dev02 fdfs]# 
    

    指定storage的目录(base_path)以及tracker服务器地址等信息等~

    network_timeout=60
    
    # the base path to store log files
    base_path=/srv/fastdfs/storage
    
    # tracker_server can ocur more than once, and tracker_server format is
    #  "host:port", host can be hostname or ip address
    tracker_server=<YOUR_IP_ADDRESS>:22122
    
    
    #HTTP settings
    http.tracker_server_port=19080
    

    测试上传文件

    创建/home/testdata/目录,并上传一张测试图片123.png,如

    [root@dev02 fdfs]# cd /home
    [root@dev02 home]# ll
    total 0
    [root@dev02 home]# mkdir testdata
    [root@dev02 home]# cd testdata/
    [root@dev02 testdata]# rz
    
    [root@dev02 testdata]# ll
    total 24
    -rw-r--r-- 1 root root 23860 Jun 28 10:26 123.png
    [root@dev02 testdata]# 
    

    /usr/bin/fdfs_test /etc/fdfs/client.conf upload /home/testdata/123.png 

    [root@dev02 ~]# /usr/bin/fdfs_test /etc/fdfs/client.conf upload /home/testdata/123.png 
    This is FastDFS client test program v5.11
    
    Copyright (C) 2008, Happy Fish / YuQing
    
    FastDFS may be copied only under the terms of the GNU General
    Public License V3, which may be found in the FastDFS source kit.
    Please visit the FastDFS Home Page http://www.csource.org/ 
    for more detail.
    
    [2017-07-03 12:28:04] DEBUG - base_path=/srv/data/fastdfs/storage, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0
    
    tracker_query_storage_store_list_without_group: 
    	server 1. group_name=, ip_addr=<YOUR_IP_ADDRESS>, port=23000
    
    group_name=group1, ip_addr=<YOUR_IP_ADDRESS>, port=23000
    storage_upload_by_filename
    group_name=group1, remote_filename=M00/00/00/rBcfaVlZx9SAO-ARAACdQEcIbGo827.png
    source ip address: <YOUR_IP_ADDRESS>
    file timestamp=2017-07-03 12:28:04
    file size=40256
    file crc32=1191734378
    example file url: http://<YOUR_IP_ADDRESS>:19080/group1/M00/00/00/rBcfaVlZx9SAO-ARAACdQEcIbGo827.png
    storage_upload_slave_by_filename
    group_name=group1, remote_filename=M00/00/00/rBcfaVlZx9SAO-ARAACdQEcIbGo827_big.png
    source ip address: <YOUR_IP_ADDRESS>
    file timestamp=2017-07-03 12:28:04
    file size=40256
    file crc32=1191734378
    example file url: http://<YOUR_IP_ADDRESS>:19080/group1/M00/00/00/rBcfaVlZx9SAO-ARAACdQEcIbGo827_big.png
    [root@dev02 ~]# 
    

    从上述日志可以看出,文件已经成功上传~

    验证

    查看storage目录下的group1/M00/00/00目录下的图片

    访问ip地址,如

    http://<IP_ADDRESS>:<IP_PORT>/group1/M00/00/00/rBcfaVlZx9SAO-ARAACdQEcIbGo827.png

    查看,可以看到页面上正常显示图片~

    小结

    1)本文完成了一个单机FastDFS环境的搭建,Tracker 和 Storage并结合Nginx的配置,最终完成文件的上传,并通过Nginx的路径来完成静态文件内容的展示~ 并对从中遇到问题进行了解决~

    2)Nginx安装前先完成依赖库的安装,以免不必要的错误~

    Nginx安装需要依赖pcre库以及zlib库

    yum -y install pcre-devel

    yum install -y zlib-devel

    下一次,结合Java示例来完成FastDFS文件的上传、删除等操作~

  • 相关阅读:
    BZOJ 1103 Poi2007 大都市meg
    BZOJ 2815 ZJOI2012 灾难
    【bzoj】1046: [HAOI2007]上升序列
    P1168跳房子(焫鷄如我)
    HAIO2017[打酱油的旅行!?]
    [haoi2013]花卉节
    P1298(矩阵切割)DP
    P1216 (list加强版)
    p1219最佳贸易(两边bfs写的)
    p1150[noip2013普及]表达式求值
  • 原文地址:https://www.cnblogs.com/shihaiming/p/8489140.html
Copyright © 2020-2023  润新知