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-module:https://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文件夾)
?
?
總結
以上是生活随笔為你收集整理的FastDFS 安装步骤(ubuntu)的全部內容,希望文章能夠幫你解決所遇到的問題。