Linux

linux安装FastDFS

2020-12-16  本文已影响0人  lzm_CX330

1.下载安装包上传到centos

FastDFS_v5.05.tar.gz (FastDFS安装包)
libfastcommonV1.0.7.tar.gz (FastDFS依赖程序)
nginx-1.8.0.tar.gz (nginx安装包,用于做文件请求http代理服务器)
astdfs-nginx-module_v1.16.tar.gz (nginx和fastdfs的桥梁插件模块)
链接:https://pan.baidu.com/s/1sR1FbaFOg0WJ2GejsaqZBw
提取码:4dxf

2.安装C/C++ 编译环境

yum -y install gcc gcc-c++
 yum -y install libevent

3.安装 libfastcommon

tar -zxf libfastcommonV1.0.7.tar.gz
cd libfastcommon-1.0.7
./make.sh
./make.sh install
cp /usr/lib64/libfastcommon.so /usr/lib

4.安装FastDFS

tar -zxf FastDFS_v5.05.tar.gz
cd FastDFS
./make.sh
./make.sh install
cd conf
cp * /etc/fdfs

5.编辑tracker.conf

vi /etc/fdfs/tracker.conf
base_path=/usr/local/fastdfs/FastDFS/tracker

6.配置storage节点

vi /etc/fdfs/storage.conf
base_path=/usr/local/fastdfs/FastDFS/storage
store_path0=/usr/local/fastdfs/FastDFS/storage
tracker_server = 本机ip:22122

7.启动服务

依次执行:

/usr/bin/fdfs_trackerd  /etc/fdfs/tracker.conf
/usr/bin/fdfs_storaged  /etc/fdfs/storage.conf

执行命令,查看服务

ps -ef|grep fdfs
启动成功

8.安装nginx,修改fastdfs-nginx-module/src/config配置文件

yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
tar -zxf nginx-1.8.0.tar.gz
cd nginx-1.8.0
./configure --add-module=/usr/local/fastdfs/fastdfs-nginx-module/src
make
make install
tar -zxf fastdfs-nginx-module_v1.16.tar.gz
cp mod_fastdfs.conf /etc/fdfs/
tracker_server=本机ip:22122
url_have_group_name = true
storage_server_port=23000
group_name=group1
store_path0=/usr/local/fastdfs/FastDFS/storage

9.配置nginx

server{
        listen 80;
        server_name localhost;
        location /group1/M00/{
           ngx_fastdfs_module;
        }
}
重启niginx: ./nginx -s reload

10.配置测试

cd /usr/local/fastdfs//FastDFS/client/
cp libfastclient.so /usr/lib
vi /etc/fdfs/client.conf
base_path=/usr/local/fastdfs/FastDFS/client
tracker_server=本机ip:22122

11.测试上传

fdfs_test /etc/fdfs/client.conf upload /root/test.jpg 
上传成功

常见问题:

fastdfs无法启动 ->查看云服务器安全组规则是否开放

上一篇 下一篇

猜你喜欢

热点阅读