歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux技術 >> Ubuntu FastDFSv5.05+Nginx1.9.15 環境搭建

Ubuntu FastDFSv5.05+Nginx1.9.15 環境搭建

日期:2017/3/3 12:29:22   编辑:Linux技術

FastDFS安裝實踐

環境簡介

Ubuntu 12.04
單台機器測試

安裝步驟

可以參照 http://dorole.com/1365/

1.安裝FastDFS基礎服務(Tracker, Storage節點都需要安裝)

1)安裝libfastcommon
git clone https://github.com/happyfish100/libfastcommon.git
cd libfastcommon/
./make.sh
./make.sh install
設置環境變量
export LD_LIBRARY_PATH=/usr/lib64/
ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
2)安裝FastDFS基礎服務
wget http://iweb.dl.sourceforge.net/project/fastdfs/FastDFS%20Server%20Source%20Code/FastDFS%20Server%20with%20PHP%20Extension%20Source%20Code%20V5.05/FastDFS_v5.05.tar.gz
tar xzf FastDFS_v5.05.tar.gz
cd FastDFS
./make.sh
./make.sh install
確認make沒有錯誤後,執行安裝,默認會安裝到/usr/bin中,並在/etc/fdfs中添加三個配置文件。

2.在Storage節點上安裝nginx+fastdfs-nginx-module

可以參照 /content/912214.html
nginx用於提供http訪問存儲的資源,fastdfs-nginx-module用於解決同一個group下資源同步延遲問題,可以將http的訪問轉發到一開始存儲的節點上。
1)安裝nginx依賴庫
zlib
wget http://zlib.net/zlib-1.2.8.tar.gz
tar xzf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure - -prefix=/usr/local/zlib-1.2.8 && make &&make install
pcre
wget http://exim.mirror.fr/pcre/pcre-8.38.tar.gz
tar xzf pcre-8.38.tar.gz
cd pcre-8.38
./configure –prefix=/usr/local/pcre-8.33 –libdir=/usr/local/lib/pcre –includedir=/usr/local/include/pcre && make && make install
openssl
wget http://www.openssl.org/source/openssl-1.0.1e.tar.gz
tar xzf openssl-1.0.1e.tar.gz
cd openssl-1.0.1e
./config –prefix=/usr/local/openssl-1.0.1e && make && make install
2)安裝ngnix
wget http://jaist.dl.sourceforge.net/project/fastdfs/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz
tar xzf fastdfs-nginx-module_v1.16.tar.gz
設置fastdfs-nginx-module使用的lib路徑
cd fastdfs-nginx-module/src
vi config
修改CORE_LIBS為
CORE_LIBS=”$CORE_LIBS -L**/usr/lib64** -lfastcommon -lfdfsclient”
為了nginx自啟動還需要
ln -n /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so
下載並安裝nginx
wget http://nginx.org/download/nginx-1.9.15.tar.gz
tar xzf nginx-1.9.15.tar.gz
cd nginx-1.9.15
./configure –prefix=/usr/local/nginx –with-pcre=/root/pcre-8.38 –with-zlib=/root/zlib-1.2.8 –add-module=/root/fastdfs-nginx-module/src –with-http_ssl_module –with-openssl=/root/openssl-1.0.1e –sbin-path=/usr/local/nginx/sbin/nginx && make && make install
3)拷貝配置文件至/etc/fdfs/
cp FastDFS(源碼解壓目錄)/conf/http.conf /etc/fdfs/
cp FastDFS(源碼解壓目錄)/conf/mime.types /etc/fdfs/
cp FastDFS(源碼解壓目錄)/conf/anti-steal.jpg /etc/fdfs/
cp fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/

3.修改配置文件

1) tracker.conf說明 http://www.tuicool.com/articles/RjQf22f
2) storage.conf說明 http://www.tuicool.com/articles/fuMJjyf
3) mod_fastdfs.conf 該文件中的配置決定了nginx的URL指向具體的文件位置
4) /usr/local/nginx/conf/nginx.conf 配置一個新的location

4.fastdfs java api開發說明

http://blog.sina.com.cn/s/blog_69357fbb0100r5c3.html
Copyright © Linux教程網 All Rights Reserved