1、下载FastDFS安装包和依赖包
https://codeload.github.com/happyfish100/libfastcommon/tar.gz/V1.0.43
https://codeload.github.com/happyfish100/fastdfs/tar.gz/V6.06
https://codeload.github.com/happyfish100/fastdfs-nginx-module/tar.gz/V1.22
注:可以使用window浏览器(下载后需要上传到服务器上),也可以使用linux的curl命令
curl -o libfastcommon-1.0.43.tar.gz https://codeload.github.com/happyfish100/libfastcommon/tar.gz/V1.0.43
curl -o fastdfs-6.06.tar.gz https://codeload.github.com/happyfish100/fastdfs/tar.gz/V6.06
curl -o fastdfs-nginx-module-1.22.tar.gz https://codeload.github.com/happyfish100/fastdfs-nginx-module/tar.gz/V1.22
2、下载nginx,可以结合fastdfs-nginx-module插件,在浏览器上访问文件
nginx: download页面
注:也可以使用curl命令直接下载到linux服务器上,这里使用的nginx版本是1.22
curl -O http://nginx.org/download/nginx-1.22.1.tar.gz
3、在/usr/local目录下创建fastdfs文件夹,并将下载的文件解压到该目录下,删除压缩包(减少存储占用,推荐)。
mkdir /usr/local/fastdfs
tar -zxvf fastdfs-6.06.tar.gz -C /usr/local/fastdfs
tar -zxvf fastdfs-nginx-module-1.22.tar.gz -C /usr/local/fastdfs
tar -zxvf libfastcommon-1.0.43.tar.gz -C /usr/local/fastdfs
tar -zxvf nginx-1.22.1.tar.gz -C /usr/local/fastdfs
rm -rf fastdfs-6.06.tar.gz fastdfs-nginx-module-1.22.tar.gz libfastcommon-1.0.43.tar.gz nginx-1.22.1.tar.gz
4、安装依赖,如果linux环境中有perl,则无需安装,否者需要安装
yum -y install gcc-c++ libevent pcre pcre-devel zlib zlib-devel openssl openssl-devel perl
1、进入/usr/local/fastdfs/libfastcommon-1.0.43目录下,执行编译安装
./make.sh # 编译
./make.sh install # 安装
1、进入到/usr/local/fastdfs/fastdfs-6.06目录下,执行编译安装
./make.sh # 编译
./make.sh install # 安装
2、执行编译安装命令之后,如果不报错的话,软件会被安装到/et/fdfs目录下,将/usr/local/fastdfs/fastdfs-6.06/conf目录下的所有文件复制到/et/fdfs目录下
cp /usr/local/fastdfs/fastdfs-6.06/conf/* /et/fdfs
3、创建tracker文件夹(存储路径使用)
mkdir -p /home/fastdfs/tracker
4、进入到/et/fdfs目录下修改tracker.conf文件
修改前:
22 # the base path to store data and log files
23 base_path = /home/yuqing/fastdfs
修改后:22 # the base path to store data and log files
23 base_path = /home/fastdfs/tracker
5、启动tracker服务(跟踪器)
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
6、创建storage文件夹
mkdir -p /home/fastdfs/storage
7、进入到/et/fdfs目录下修改storage.conf文件
修改前:
48 # eg. the disk free space should > 50GB
49 base_path = /home/yuqing/fastdfs # 默认存储路径
127 # the base_path should be independent (different) of the store paths
128
129 store_path0 = /home/yuqing/fastdfs # 默认存储路径
143 # another eg.: 192.168.1.10,172.17.4.21:22122
144
145 tracker_server = 192.168.209.121:22122
146 tracker_server = 192.168.209.122:22122修改后:
48 # eg. the disk free space should > 50GB
49 base_path = /home/fastdfs/storage
127 # the base_path should be independent (different) of the store paths
128
129 store_path0 = /home/fastdfs/storage
143 # another eg.: 192.168.1.10,172.17.4.21:22122
144
145 tracker_server = 本地IP:22122
146 tracker_server = 本地IP:22122
8、启动storage服务(存储器)
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf
9、创建client文件夹(客户端)
mkdir -p /home/fastdfs/client/
10、进入到/et/fdfs目录下修改client.conf文件
修改前:
10 # the base path to store log files
11 base_path = /home/yuqing/fastdfs
20 # another eg.: 192.168.1.10,172.17.4.21:22122
21
22 tracker_server = 192.168.0.196:22122
23 tracker_server = 192.168.0.197:22122
修改后:# the base path to store log files
base_path = /home/fastdfs/client
# another eg.: 192.168.1.10,172.17.4.21:22122
tracker_server = 本地IP:22122
#tracker_server = 192.168.0.197:22122
11、测试系统是否可用
fdfs_test /etc/fdfs/client.conf upload storage.conf
1、进入到 /usr/local/fastdfs/nginx-1.22.1文件下
#配置nginx --prefix 安装目录,--with-http_ssl_module 使用ssl模块,--add-module 使用nginx插件
./configure --prefix=/usr/local/nginx --with-http_ssl_module --add-module=/usr/local/fastdfs/fastdfs-nginx-module-1.22/src
2、编译并安装nginx
make && make install
4、配置nginx.conf文件
5、启动nginx,并访问浏览器,当我们访问文件地址的时候,会直接下载