centos 上安装FastDFS

1、软件准备

wget https://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gz
wget http://jaist.dl.sourceforge.net/project/fastdfs/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz
wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz
wget http://nginx.org/download/nginx-1.6.0.tar.gz


2、环境安装

1、安装gcc(编译时需要)
yum install -y gcc gcc-c++

FastDFS是C语言开发,安装FastDFS需要先将官网下载的源码进行编译,编译依赖gcc环境,如果没有gcc环境,需要安装gcc

2、安装libevent(运行时需求)

若安装了桌面图形界面,就不需要安装;FastDFS依赖libevent库;

yum -y install libevent
3、libfastcommon 的安装

(1)将上面下载的 V1.0.7.tar.gz 重命名为 libfastcommon-1.0.7.tar.gz 并解压到/usr/local/ 目录下

重命名:

cp V1.0.7.tar.gz  libfastcommon-1.0.7.tar.gz

解压到 /usr/local/ 目录下:

tar -zxvf libfastcommon-1.0.7.tar.gz  -C /usr/local

(2)进入 /usr/local/libfastcommon-1.0.7/目录下,进行编译和安装

cd /usr/local/libfastcommon-1.0.7/
./make.sh           #编译
./make.sh install   #安装

安装成功如下图
在这里插入图片描述
(3)libfastcommon安装好后会在/usr/lib64 目录下生成 libfastcommon.so 库文件;

注意:由于FastDFS程序引用usr/lib目录所以需要将/usr/lib64下的库文件拷贝至/usr/lib下。

cp libfastcommon.so /usr/lib
4、安装tracker

(1)将从wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz 下载的V5.05.tar.gz 重命名为 FastDFS_v5.05.tar.gz ;

(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  #编译之后接着进行安装

安装后成功如下图:在这里插入图片描述

(4)安装成功将安装目录下的conf下的文件拷贝到/etc/fdfs/下;

cp /usr/local/FastDFS/conf/* /etc/fdfs/

如下图所示:在这里插入图片描述

5、配置和启动tracker

(1)切换目录到: /etc/fdfs/ 目录下;

(2)拷贝一份新的tracker配置文件

cp tracker.conf.sample tracker.conf

(3)修改tracker.conf ; vim tracker.conf

base_path=/home/yuqing/fastdfs  改为:  base_path=/home/fastdfs
http.server_port  改为: 80
base_path=/home/fastdfs
http.server_port=80  #配置http端口

(4)创建 /home/fastdfs 目录

mkdir /home/fastdfs

(5)启动tracker,运行如下命令:

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

查看是否启动成功:

ps -ef | grep fdfs

若启动成功如下图:在这里插入图片描述

6、配置和启动storage

由于上面已经安装过FastDFS,这里只需要配置storage就好了;

(1)切换目录到: /etc/fdfs/ 目录下;

(2)修改storage.conf ; vim storage.conf

group_name=group1 #配置组名
base_path=/home/yuqing/fastdfs    改为:  base_path=/home/fastdfs

#store存放文件的位置(store_path)
store_path0=/home/yuqing/fastdfs  改为: store_path0=/home/fdfs_storage 
#如果有多个挂载磁盘则定义多个store_path,如下
#store_path1=.....
#store_path2=......

#配置tracker服务器:IP
tracker_server=192.168.172.20:22122
#如果有多个则配置多个tracker
#tracker_server=192.168.101.4:22122

#配置http端口
http.server_port=88

(4)创建 /home/fdfs_storage 目录

mkdir /home/fdfs_storage

(5)启动storage, 运行命令如下:

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

启动成功如下图:在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值