主要目的:1.实现在浏览器中访问上传到fastDfs的图片;2.安装php fastdfs扩展实现php对fastdfs的相关操作与使用;FastDFS 系统有三个角色:跟踪服务器(Tracker Server)、存储服务器(Storage Server)和客户端(Client),相关原理参考:https://www.jianshu.com/p/d09e52ff947f
一.环境准备:
lnmp环境(或同时安装nginx和php等),libfastcommonan安装包,FastDFS安装包,fastdfs-nginx-module安装包.本文中相关安装包为:fastdfs-nginx-module_v1.16.tar.gz;libfastcommonV1.0.7.tar.gz;nginx-1.14.1.tar.gz;php-5.6.38.tar.gz
注意下载FastDFS源程序,最好与FastDFS服务器版本匹配.php7+安装fastdfs时回报错,fastdfs的php_client应该不支持php7+;
相关目录说明:
FastDFS数据根目录:/home/fastdfs
Tracker数据日志目录:/home/fastdfs/tracker
Storage数据日志目录:/home/fastdfs/storage
软件包存放目录:/usr/local/
安装包下载: https://pan.baidu.com/s/1AoP60trHoUP1tfS223SOeQ 提取码: ydak
二.安装步骤:
1.如果没有安装gcc环境,先安装gcc,FastDFS是c开发的,编译依赖gcc环境;
2.安装libevent库,因为FastDFS依赖该库,yum安装:
yum -y install libevent
3.安装ibfastcommon
libfastcommon是FastDFS官方提供的,libfastcommon包含了FastDFS运行所需要的一些基础库;
(1)上传 libfastcommonV1.0.7.tar.gz到Centos机器上;
(2)将 libfastcommonV1.0.7.tar.gz解压至/usr/local/下:
tar -zxvf libfastcommonV1.0.7.tar.gz -C /usr/local/
(3)切换目录到:/usr/local/libfastcommon-1.0.7/ 下,接着进行编译和安装;
cd /usr/local/libfastcommon-1.0.7/
./make.sh #编译
./make.sh install #安装
安装后截图:

(4)libfastcommon安装好后会在/usr/lib64 目录下生成 libfastcommon.so 库文件;
注意:由于FastDFS程序引用usr/lib目录所以需要将/usr/lib64下的库文件拷贝至/usr/lib下。
cp libfastcommon.so /usr/lib
4.安装tracker
(1)上传 FastDFS_v5.05.tar.gz 到 centos 上;
(2)将FastDFS_v5.05.tar.gz 解压至/usr/local/下
tar -zxvf FastDFS_v5.05.tar.gz -C /usr/local
(3)切换目录到: /usr/local/FastDFS/ 下,编译和安装;
cd /usr/local/FastDFS/
./make.sh && ./make.sh install #编译之后接着进行安装
安装后截图如下:
