FastDFS 安装步骤(ubuntu)

本人linux使用的ubuntu版本。

 

详细步骤

1.下载安装包
   源码在google的code服务器上有,不想翻墙了,直接去源码中国下载了。

   目前最新版本为5.05   全名  fastdfs-5.05.tar.gz

   或者去这里下载:(版本又更新了5.11)
      https://github.com/happyfish100/fastdfs/releases/tag/V5.10

   或者去这里下载:https://sourceforge.net/projects/fastdfs/

   

 

2.安装网络驱动包(最新的fastdfs,安装支持插件libfastcommon即可,不在需要libevent了

   下载安装libfastcommon
                到https://github.com/happyfish100/libfastcommon  点击绿色按钮下载  libfastcommon-master.zip

 

3. 下载好fastdfs-nginx-modulehttps://github.com/happyfish100/fastdfs-nginx-module

 

4. 将上面下载好的zip包,上传到linux中

 

5. 安装libfastcommon-master.zip

  1). 解压

使用tar解压,可能会出现如下错误.   这时候使用unzip解压.

       gzip: stdin has more than one entry--rest ignored

 

    安装unzip( apt-get install unzip )

 

安装好unzip后,解压,

 

2).进入libfastcommon-master,  执行 make.sh 进行编译   

 3).编译好后,进行安装(./make.sh install)

 4).设置环境变量和软链接

在32位ubuntu中,libfastcommon会安装在/usr/lib 中,64位系统则安装在 /usr/lib64 中。依次执行以下命令:(根据自己的操作系统选择路径)

ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so

 

6. 安装FastDFS

 1). 解压FastDFS_v5.08.tar.gz(  tar -zxvf FastDFS_v5.08.tar.gz )

2).进入FastDFS,  执行 make.sh 进行编译  

3). 编译好后,进行安装(./make.sh install)

4). 修改配置文件, 在默认安装路径 /etc/fdfs 下,有三个示例配置文件:

 

复制这三个文件,将sample去掉,改为: 

cp tracker.conf.sample tracker.conf
cp storage.conf.sample storage.conf
cp client.conf.sample client.conf

 

  4.1). 修改tracker.conf 

# the base path to store data and log files
base_path=/var/data/fastdfs-tracker

注意: /var/data/fastdfs-tracker这个路径是根据实际情况自定义的,文件路径需要安装者手动创建,否则后续步骤会报“路径不存在”的错误

   4.2).修改storage.conf 

# the base path to store data and log files
base_path=/var/data/fastdfs-storage/base

# store_path#, based 0, if store_path0 not exists, it's value is base_path
# the paths must be exist
store_path0=/var/data/fastdfs-storage/data

# tracker_server can ocur more than once, and tracker_server format is
#  "host:port", host can be hostname or ip address
tracker_server=192.168.176.131:22122

  4.3).修改client.conf 

# the base path to store log files
base_path=/var/data/fastdfs-client

# tracker_server can ocur more than once, and tracker_server format is
#  "host:port", host can be hostname or ip address
tracker_server=192.168.176.131:22122

 

 

7启动服务

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

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

 

执行以下命令,验证服务:

ps -ef |grep fdfs

 

8:测试上传文件

首先准备一张图片文件,例如:/usr/local/suolong.jpg

将这张图片上传至FastDFS,执行:

fdfs_test /etc/fdfs/client.conf upload /usr/local/suolong.jpg

上传成功

9. 删除文件

group1表示组,   M00表示磁盘路径(store_path0),   00/00 表示路径下具体路径(即tore_path0路径下00文件夹下的00文件夹)

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章