分布式文件系统FastDFS安装

1.准备工作

(1)centos 7;

(2)下载安装包

https://github.com/happyfish100/FastDFS

(3)安装gcc环境(FastDFS由c语言开发,需依赖gcc环境)

yum源安装:

sudo yum install gcc-c++

2.安装libevent

FastDFS依赖libevent库

yum -y install libevent

3.安装libfastcommon

libfastcommon包含了FastDFS运行所需要的一些基础库

(1)上传并解压

tar -zxvf libfastcommonV1.0.7.tar.gz

(2)拷贝至/usr/local

cp libfastcommon-1.0.7 /usr/local

(3)进入 /usr/local/libfastcommon-1.0.7目录

cd /usr/local/libfastcommon-1.0.7

(4)编译安装

./make.sh

./make.sh install

(5)将/usr/lib64目录下的库文件libfastcommon.so拷贝至/usr/lib下

(fastdfs程序引用/usr/lib目录)

cp /usr/lib64/libfastcommon.so /usr/lib

4.tracker编译安装

(1)上传解压并拷贝安装包至/usr/local/目录

cp -r FastDFS /usr/local/

(2)编译安装

cd /usr/local/FastDFS

./make.sh

./make.sh install

(3)将安装目录下的conf下的文件拷贝到/etc/fdfs/下

cp -r * /etc/fdfs/

(4)配置

cd /etc/fdfs

修改tracker.conf

vi tracker.conf

修改base_path=/home/yuqing/FastDFS为base_path=/home/FastDFS

配置http端口为80

(5)启动

/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start

5.storage配置

进入/etc/fdfs/目录

vi storage.conf

修改base_path=/home/yuqing/FastDFS为:base_path=/home/gao/FastDFS_file

修改store_path0=/home/yuqing/FastDFS为store_path0=/home/gao/FastDFS_file/fdfs_storage

配置tracker服务器ip

配置http端口为80

启动

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

 

6.上传测试

(1)修改/etc/fdfs/client.conf 

base_path=/home/gao/FastDFS_file/

tracker_server=192.168.131.203tracker_server:22122

(2)通过/usr/bin/fdfs_test程序来测试上传、下载

格式:/usr/bin/fdfs_test 客户端配置文件地址 upload 上传文件

/usr/bin/fdfs_test /etc/fdfs/client.conf upload /home/gao/fdfs_test.jpg

url: http://192.168.231.203/group1/M00/00/00/wKjny14CwquAL21YAADv_ogadi0804_big.jpg

7.FastDFS 和nginx整合

(1)将FastDFS-nginx-module_v1.16.tar.gz文件上传解压并拷贝至/usr/local目录中

(2)进入/usr/local/fastdfs-nginx-module/src目录,编辑config文件,将/usr/local/路径改为/usr/

(3)拷贝mod_fastdfs.conf到etc/fdfs

cp mod_fastdfs.conf /etc/fdfs

进入/etc/fdfs,编辑 mod_fastdfs.conf文件

base_path=/home/gao/FastDFS_file/

tracker_server=192.168.231.203:22122

url_have_group_name = true //允许使用组名

store_path0=/home/gao/FastDFS_file/fdfs_storage #指定文件存储路径

8.nginx安装

(1)上传nginx-1.8.0.tar.gz,解压

进入nginx-1.8.0,执行下面配置命令

./configure  --prefix=/usr/local/nginx  --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock  --error-log-path=/var/log/nginx/error.log  --http-log-path=/var/log/nginx/access.log --with-http_gzip_static_module  --http-client-body-temp-path=/var/temp/nginx/client  --http-proxy-temp-path=/var/temp/nginx/proxy  --http-fastcgi-temp-path=/var/temp/nginx/fastcgi  --http-uwsgi-temp-path=/var/temp/nginx/uwsgi  --http-scgi-temp-path=/var/temp/nginx/scgi --add-module=/usr/local/fastdfs-nginx-module/src

(2)编译安装

make

make install

(3)修改nginx配置文件

cd /usr/local/nginx/conf/

vi nginx.conf

添加配置

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值