1、下载安装包
wget https://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gz
wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz
2、编译
cd libfastcommon-1.0.7
./make.sh
./make.sh install
安装libfastcommon成功!
cd fastfds-5.05
./make.sh
./make.sh install
3、配置 Tracker 服务
在/etc/
目录下会有一个fdfs
的目录,
分别cp
创建文件夹 mkdir -p /data/fastdfs/tracker
vim tracker.conf
base_path=/data/fastdfs/tracker
正常启动/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start
创建软链接
ln -s /usr/bin/fdfs_trackerd /usr/local/bin
ln -s /usr/bin/stop.sh /usr/local/bin
ln -s /usr/bin/restart.sh /usr/local/bin
service fdfs_trackerd start
tracker启动成功!
vim storage.conf
base_path=/data/fastdfs/storage
store_path0=/data/fastdfs/storage
tracker_server=10.101.22.18:22122 自身开发机,端口不改
创建软链接
ln -s /usr/bin/fdfs_storaged /usr/local/bin
service fdfs_storaged start
storage启动成功!
监听端口
netstat -unltp|grep fdfs
监视tracker和storage服务是否通信
/usr/bin/fdfs_monitor /etc/fdfs/storage.conf
4、配置 Client 服务
vim storage.conf
base_path=/data/fastdfs/tracker
tracker_server=10.101.22.18:22122 自身开发机,端口不改
5、nginx 安装
tar xf fastdfs-nginx-module_v1.16.tar.gz
cd fastdfs-nginx-module/src/
vim config
编辑config文件,执行如下命令进行批量替换并保存退出
:%s+
/usr/local/
+
/usr/
+g
cp /home/oldcat/tools/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
vim /etc/fdfs/mod_fastdfs.conf
修改内容如下:
connect_timeout=10
base_path=
/tmp
(默认为
/tmp
)
tracker_server=10.101.22.18:22122
storage_server_port=23000(默认配置为23000)
url_have_group_name =
true
store_path0=
/data/fastdfs/storage
group_name=group1(默认配置为group1)
|
3)安装nginx依赖库
yum install -y pcre-devel zlib-devel
tar xf nginx-1.8.1.tar.gz
cd nginx-1.8.1
./configure --prefix=/application/nginx/ --add-module=../fastdfs-nginx-module/src/
make && make install
|
4)拷贝FastDFS中的部分配置文件到/etc/fdfs目录中
cp /home/oldcat/tools/FastDFS/conf/http.conf /etc/fdfs/
cp /home/oldcat/tools/FastDFS/conf/mime.types /etc/fdfs/
|
5)配置nginx,如下所示:
vim /application/nginx/conf/nginx.conf
user root;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application
/octet-stream
;
sendfile on;
keepalive_timeout 65;
server {
listen 8888;
server_name localhost;
location ~
/group
[0-9]/ {
ngx_fastdfs_module;
}
error_page 500 502 503 504
/50x
.html;
location =
/50x
.html {
root html;
}
}
}
|