FastDfs安装-Centos7

1、上传安装文件至/home/soft/fastdfs目录:
fastdfs-5.11.zip
fastdfs-nginx-module_v1.16.tar.gz
libfastcommon-1.0.36.tar.gz

2、安装libfastcommon:
[root@db101 fastdfs]# tar -zxvf libfastcommon-1.0.36.tar.gz && cd libfastcommon-1.0.36
[root@db101 libfastcommon-1.0.36]# ./make.sh
[root@db101 libfastcommon-1.0.36]# ./make.sh install

3、安装fastDfs:
[root@db101 fastdfs]# unzip fastdfs-5.11.zip && cd fastdfs-5.11
[root@db101 fastdfs-5.11]# ./make.sh
[root@db101 fastdfs-5.11]# ./make.sh install

4、修改配置文件
[root@db101 fastdfs]# mkdir /data
[root@db101 fastdfs]# mkdir /data/fastdfs
[root@db101 fastdfs]# mkdir /data/fastdfs/storage
[root@db101 fastdfs]# cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf
[root@db101 fastdfs]# cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
[root@db101 fastdfs]# cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
[root@db101 fastdfs]# vi /etc/fdfs/tracker.conf
修改内容:
base_path=/home/yuqing/fastdfs
http.server_port=8080
改为:
base_path=/data/fastdfs
http.server_port=80

[root@db101 fastdfs]# vi /etc/fdfs/storage.conf
修改内容:
base_path=/home/yuqing/fastdfs
store_path0=/home/yuqing/fastdfs
tracker_server=192.168.209.121:22122
改为:
base_path=/data/fastdfs/storage
store_path0=/data/fastdfs/storage
tracker_server=192.168.0.101:22122

[root@db101 fastdfs]# vi /etc/fdfs/client.conf
修改内容:
base_path=/home/yuqing/fastdfs
tracker_server=192.168.0.197:22122
改为:
base_path=/data/fastdfs/storage
tracker_server=192.168.0.101:22122
[root@db101 bin]# ln -s /usr/bin/fdfs_trackerd /usr/local/bin
[root@db101 bin]# ln -s /usr/bin/fdfs_storaged /usr/local/bin

5、启动并监听服务:
[root@db101 local]# service fdfs_trackerd start
[root@db101 local]# service fdfs_storaged start
# 监听:22122、23000端口已启动
[root@db101 bin]# netstat -unltp|grep fdfs
# 监听
[root@db101 bin]# /usr/bin/fdfs_monitor /etc/fdfs/storage.conf

6、安装nginx+fastdfs-nginx-module:
[root@db101 fastdfs]# tar -zxvf fastdfs-nginx-module_v1.16.tar.gz && cd fastdfs-nginx-module
[root@db101 fastdfs]# vi src/mod_fastdfs.conf
修改内容:
tracker_server=tracker:22122
url_have_group_name = false
store_path0=/home/yuqing/fastdfs
改为:
tracker_server=192.168.0.101:22122
url_have_group_name = true
store_path0=/data/fastdfs/storage
[root@db101 fastdfs]# vi src/config
修改内容:
CORE_INCS=”$CORE_INCS /usr/local/include/fastdfs /usr/local/include/fastcommon/”
CORE_LIBS=”$CORE_LIBS -L/usr/local/lib -lfastcommon -lfdfsclient”
改为:
CORE_INCS=”$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/”
CORE_LIBS=”$CORE_LIBS -L/usr/lib -lfastcommon -lfdfsclient”
[root@db101 fastdfs-nginx-module]# cp /home/soft/fastdfs/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
[root@db101 fastdfs-nginx-module]# cd /home/soft/
[root@db101 soft]# tar -zxvf nginx-1.14.2.tar.gz && cd nginx-1.14.2
[root@db101 nginx-1.14.2]# ./configure –(两个横杠)add-module=/home/soft/fastdfs/fastdfs-nginx-module/src/
[root@db101 nginx-1.14.2]# make
[root@db101 nginx-1.14.2]# make install

7、剩余配置文件:
[root@db101 nginx-1.14.2]# cd /home/soft/fastdfs/fastdfs-5.11/conf/
[root@db101 conf]# cp anti-steal.jpg http.conf mime.types /etc/fdfs/
[root@db101 conf]# mkdir /data/fastdfs/storage/data/group1
[root@db101 conf]# ln -s /data/fastdfs/storage/data /data/fastdfs/storage/data/group1/M00
[root@db101 conf]# vi /usr/local/nginx/conf/nginx.conf
#添加内容
location /group1/M00 {
root /data/fastdfs/storage/;
ngx_fastdfs_module;
}
[root@db101 conf]# /usr/local/nginx/sbin/nginx -s reload

8、测试:
[root@db101 home]# vi text.txt
[root@db101 home]# /usr/bin/fdfs_test /etc/fdfs/client.conf upload /home/text.txt
example file url: http://192.168.0.101/group1/M00/00/00/wKgAZVxQ7xGAfIbRAAAAB6tlxWA769.txt

ˆ Back To Top