linux 下安装fastdfs-client

安装环境:centos
软件版本: libevent :libevent-1.4.14b-stable.tar.gz
FastDFS: v3.05(注 : v4.06不支持 http)

FastDFS内部绑定了libevent作为http服务器,必须安装libevent。
1.判断是否安装了libevent
命令:rpm -qa|grep libevent。如果有输出,则说明已经安装了libevent;Fastdfs对libevent版本有要求,所以先删除系统自带的libevent,然后安装最新稳定版本。
2.卸载已有的libevent
命令:rpm -e libevent –nodeps

3.安装最新的libevent(例如:libevent-2.0.21-stable.tar.gz)
命令:tar zvxf libevent-2.0.21-stable.tar.gz
命令:cd libevent-2.0.21-stable
命令:./configure –prefix=/usr
命令:make
命令:make install
4.检查是否安装成功
命令:ls –al /usr/lib |grep libevent(或者ls –al /usr/local/lib |grep libevent) 若有结果,则说明安装正确
5.为libevent创建软链接到/lib库下(64位系统对应/lib64)
假设libevent 的安装目录在/usr/local/lib/下
命令:ln –s /usr/local/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5
命令:ln –s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5(64位系统)(ln -s /usr/local/lib/libevent* /lib64/)

2:为Trackerd节点安装FastDFS,并修改配置文件/etc/fdfs/tracker.conf( 如果Trackerd需要使用内置的web server,需要修改make文件,启用WITH_HTTPD=1再编译)
cd /home/ylh
wget http://fastdfs.googlecode.com/files/FastDFS_v3.06.tar.gz
tar -zxvf FastDFS_v3.06.tar.gz
cd FastDFS_v3.06
./make.sh
./make.sh install
创建存储目录
mkdir /home/ylh/fastdfs
修改配置文件. vim /etc/fdfs/tracker.conf 修改后保存退出
启动Trackerd
/usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf

3:为Storaged节点安装FastDFS, Storaged节点也需要libevent,安装步骤参见第一步
cd /home/ylh
wget http://fastdfs.googlecode.com/files/FastDFS_v3.06.tar.gz
tar -zxvf FastDFS_v3.06.tar.gz
cd FastDFS_v3.06
./make.sh
./make.sh install

4:为Storaged节点安装web服务器,Storaged节点可以使用nginx或者apache提供http下载服务。这里我们选用nginx。
cd /home/ylh
wget http://nginx.org/download/nginx-0.8.55.tar.gz
tar zxvf nginx-0.8.55.tar.gz
cd nginx-0.8.55
./configure –prefix=/opt/nginx –with-http_stub_status_module
make && make install

5:为Storaged节点安装fastdfs-nginx-module
cd /home/ylh
wget http://fastdfs.googlecode.com/files/fastdfs-nginx-module_v1.10.tar.gz
tar xzf fastdfs_nginx_module_v1.05.tar.gz
cd /home/ylh/nginx-0.8.55 ./configure –add-module=/home/ylh/fastdfs-nginx-module/src
make; make install

6:修改nginx配置文件并保存退出 (vim /usr/local/nginx/conf/nginx.conf)
location /M00 {
root /home/ylh/fastdfs/data;
ngx_fastdfs_module;
}

7:拷贝并修改nginx模块配置文件
cp /home/ylh/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs
vim 修改/etc/fdfs/mod_fastdfs.conf 保存退出
启动nginx
/usr/local/nginx/sbin/nginx

8:修改Storaged节点的配置文件/etc/fdfs/storage.conf,启动Storaged
创建存储目录 mkdir /home/ylh/fastdfs
修改配置 vim /etc/fdfs/storage.conf 修改后保存退出
启动 Storaged
/usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf

9:测试
修改客户端配置文件/etc/conf/client.conf文件并保存退出
测试上传
/usr/local/bin/ fs_test /etc/conf/client.conf upload /home/a.jpg
如果上传成功回显信息中有文件的url,在浏览器中,输入url地址, tracker server会自动重定向到存储文件的storage server,文件下载成功。
至此,已经成功搭建了FastDFS

原文地址:http://www.jb51.net/os/RedHat/61572.html
参考地址 :http://www.tuicool.com/articles/AJBV3yB

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值