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系统结构如下图所示:

CentOS上安装分布式文件系统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 -