1. 程式人生 > >centos安裝FastDFS+Nginx

centos安裝FastDFS+Nginx

一、在安裝FastDFS之前必須先安裝libevent,安裝libevent步驟如下:

1.下載libevent:

tar -zxvpf libevent-2.0.21-stable.tar.gz

3.進入解壓目錄:

cd libevent-2.0.21-stable

4.指定安裝目錄:

./configure --prefix=/usr/local/libevent-2.0.21

5.安裝libevent:

make

make install

二、安裝FastDFS步驟如下:

1.下載FastDFS:

2.解壓FastDFS:

tar xvf FastDFS_v4.06.tar.gz

3.進入解壓目錄:

cd FastDFS
4.修改FastDFS的安裝檔案:

vi make.sh

TARGET_PREFIX=/usr/local/FastDFS  ---安裝路徑  

TARGET_CONF_PATH=/etc/fdfs  ---配置檔案路徑  

WITH_LINUX_SERVICE=1   ---是否為linux服務  

5.指定libevent的lib目錄:

./make.sh C_INCLUDE_PATH=/usr/local/libevent-2.0.21/include LIBRARY_PATH=/usr/local/libevent-2.0.21/lib
6.安裝FastDFS:

./make.sh install

7.設定軟連線(否則編譯nginx時會出錯)
ln -sv /usr/local/FastDFS/include/fastcommon /usr/local/include/fastcommon
ln -sv /usr/local/FastDFS/include/fastdfs /usr/local/include/fastdfs
ln -sv /usr/local/FastDFS/lib/libfastcommon.so /usr/local/lib/libfastcommon.so
ln -sv /usr/local/FastDFS/lib/libfastcommon.so.1 /usr/local/lib/libfastcommon.so.1
ln -sv /usr/local/FastDFS/lib/libfdfsclient.so /usr/local/lib/libfdfsclient.so
ln -sv /usr/local/FastDFS/lib/libfdfsclient.so.1 /usr/local/lib/libfdfsclient.so.1

三、在安裝Nginx之前,需要安裝gcc、 openssl-devel、 pcre-devel和zlib-devel軟體庫,具體如下:

yum install gcc-c++

yum install openssl-devel

yum install pcre-devel

yum install zlib-devel

四、安裝Nginx和fastdfs-nginx-module

將安裝包檔案上傳到/usr/local中執行以下操作:

1.進入檔案目錄:

cd /usr/local

2.解壓安裝包:

tar -zxv -f nginx-1.6.0.tar.gz

tar -xvf fastdfs-nginx-module_v1.15.tar.gz

3.修改安裝包目錄名稱:

mv nginx-1.6.0 nginx

4.進入安裝包目錄:

cd /usr/local/nginx

5.配置安裝目錄:

./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/nginx.conf  --add-module=/usr/local/fastdfs-nginx-module/src
6.安裝Nginx:

make
make install

7.修改防火牆:

vi + /etc/sysconfig/iptables

8.新增配置項
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

9.重啟防火牆:

service iptables restart

 10.將libfastcommon.so、libfastcommon.so.1、libfdfsclient.so、libfdfsclient.so.1複製到/usr/lib,

否則nginx啟動會報錯。

Nginx的操作:

啟動:

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
或者

cd /usr/local/nginx/sbin
./nginx

停止服務:

#查詢nginx主程序號
ps -ef | grep nginx
#停止程序
kill -QUIT 主程序號
#快速停止
kill -TERM 主程序號
#強制停止
pkill -9 nginx

重啟:

/usr/local/nginx/sbin/nginx -s reload

五、配置tracker server:

1. vi /etc/fdfs/tracker.conf
bind_addr=192.168.227.128
base_path=/home/tracker/fastdfs

2.配置防火牆:

iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22122 -j

3.儲存配置:

/etc/init.d/iptables save
4. 啟動 tracker
/usr/local/FastDFS/bin/fdfs_trackerd /etc/fdfs/tracker.conf

在啟動時報錯:

/usr/local/bin/fdfs_trackerd: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory

執行下面的命令即可正常啟動:

echo '/usr/local/libevent-2.0.21/include/' >> /etc/ld.so.conf
echo '/usr/local/libevent-2.0.21/lib/' >> /etc/ld.so.conf
 ldconfig
5. 檢視監聽程式:

netstat -ntpl | grep fdfs

6. 檢視日誌檔案:

cat /home/tracker/fastdfs/logs/trackerd.log
7.新增開機啟動命令列:

vim /etc/rc.d/rc.local
/usr/local/FastDFS/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart

六、配置storage server
1. vi /etc/fdfs/storage.conf
group_name=group1
bind_addr=192.168.227.130
base_path=/home/storage/fastdfs
store_path0=/home/storage/fastdfs
tracker_server=192.168.227.130:22122
http.server.port=80

2. cp /usr/local/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/

3. vi /etc/fdfs/mod_fastdfs.conf
base_path=/home/storage1/fastdfs
group_name=group1

store_path0=/home/stroage1/fastdfs

tracker_server=192.168.227.128:22122

url_have_group_name = true
group_count = 0

4. vi /usr/local/nginx/conf/nginx.conf
   location /group1/M00 {
            root /home/storage1/fastdfs/data;
            ngx_fastdfs_module;
}

5.配置防火牆:

iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 23000 -j ACCEPT

6.儲存配置:

/etc/init.d/iptables save

7.啟動 storage  
/usr/local/FastDFS/bin/fdfs_storaged /etc/fdfs/storage.conf

8. 檢視監聽程式:

netstat -ntpl | grep fdfs

9. 檢視日誌檔案:

cat /home/storage/fastdfs/logs/storaged.log

七、測試:

 /usr/local/FastDFS/bin/fdfs_test /etc/fdfs/client.conf upload /etc/passwd
結果如下:

This is FastDFS client test program v4.06

Copyright (C) 2008, Happy Fish / YuQing

FastDFS may be copied only under the terms of the GNU General
Public License V3, which may be found in the FastDFS source kit.
Please visit the FastDFS Home Page http://www.csource.org/
for more detail.

[2014-06-03 20:26:21] DEBUG - base_path=/home/client/fastdfs, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0

tracker_query_storage_store_list_without_group:
 server 1. group_name=, ip_addr=192.168.227.130, port=23000

group_name=group1, ip_addr=192.168.227.130, port=23000
storage_upload_by_filename
group_name=group1, remote_filename=M00/00/00/wKjjglOOkd2AdZiiAAAFng0Nczs9728851
source ip address: 192.168.227.130
file timestamp=2014-06-03 20:26:21
file size=1438
file crc32=218985275
file url: http://192.168.227.130/group1/M00/00/00/wKjjglOOkd2AdZiiAAAFng0Nczs9728851
storage_upload_slave_by_filename
group_name=group1, remote_filename=M00/00/00/wKjjglOOkd2AdZiiAAAFng0Nczs9728851_big
source ip address: 192.168.227.130
file timestamp=2014-06-03 20:26:21
file size=1438
file crc32=218985275
file url: http://192.168.227.130/group1/M00/00/00/wKjjglOOkd2AdZiiAAAFng0Nczs9728851_big
 

測試成功!!!

相關推薦

centos安裝FastDFS+Nginx

一、在安裝FastDFS之前必須先安裝libevent,安裝libevent步驟如下: 1.下載libevent: tar -zxvpf libevent-2.0.21-stable.tar.gz 3.進入解壓目錄: cd libevent-2.0.21-stable 4

安裝FastDFS+Nginx

解決 重新 nginx centos processes chkconfig tail 證明 上傳 安裝FastDFS FastDFS開發者的GitHub地址為:https://github.com/happyfish100 打開上述鏈接,我們點擊fastdfs–>r

阿里雲centos安裝jdk,nginx,redis

https://blog.csdn.net/w592376568/article/details/79109445 https://www.cnblogs.com/zs-notes/p/8535275.html https://blog.csdn.net/unhejing/article

centos 安裝Nginx後,為什麼訪問不了?

很多時候,安裝完成後,服務也啟動了 但是訪問不了 看看是不是防火牆開啟了; 本地試下埠是否可訪問telnet 192.168.4.155 80 CentOS 7預設使用的是firewall作為防火牆,這裡改為iptables防火牆。 firewall: systemc

CentOS安裝配置nginx-rtmp-module(同時支持IPv4和IPv6)

最好 ive install module to change str style 一個 arc   因測試需要配置IPv6環境下的rtmp流媒體服務器,想著直接使用docker鏡像,搜索對比後發現這個能滿足要求: https://hub.docker.com

Linux安裝FastDFS+Nginx檔案伺服器

環境準備安裝gccFastDFS是C語言開發,建議在linux上執行,文件中使用Centos6.5作為安裝環境。安裝FastDFS需要先將官網下載的原始碼進行編譯,編譯依賴gcc環境;所以需要安裝gcc。yum install gcc-c++安裝libeventFastDFS

Centos7 安裝FastDFS+nginx module

FastDFS是一個開源的分散式檔案系統,她對檔案進行管理,功能包括:檔案儲存、檔案同步、檔案訪問(檔案上傳、檔案下載)等,解決了大容量儲存和負載均衡的問題。特別適合以檔案為載體的線上服務,如相簿網站、視訊網站等等。 FastDFS服務端有兩個角色:跟蹤器(t

FastDFS單點在 CentOS 安裝部署

fastdfs centos 單點 關於分布式文件系統FastDFS,在這裏不做過多介紹,我們直接開始安裝1.安裝 libfastcommon [[email protected]/* */ softwares]# yum -y install wget pcre pcre-devel

centos 安裝nginx

regular all ech .tar.gz roc pidfile mes sed exp 1、準備工作選首先安裝這幾個軟件:GCC,PCRE(Perl Compatible Regular Expression),zlib,OpenSSL。Nginx是C寫的,需要用G

Centos 7.X部署分布式文件系統:FastDFS+Nginx

fastdfs 分布式文件系統 fastdfs fastdfs+nginx 甘兵 1、FastDFS簡介1.1 介紹FastDFS是一個開源的,高性能的的分布式文件系統,他主要的功能包括:文件存儲,同步和訪問,設計基於高可用和負載均衡,FastDFS非常適用於基於文件服務的站點,例如圖片分

FastDFS+nginx安裝配置

裝配 info conf 技術 運行 http.conf roo 解壓 pcr 1 安裝依賴 yum -y install gcc-c++ zlib-devel pcre-devel 2 創建安裝路徑 mkdir -p /usr

centos安裝nginx步驟

stop 命令 1.10 sbin c-c++ local pcr open .tar.gz 1、首先需要安裝gccyum install gcc-c++ 2、PCRE pcre-devel 安裝yum install -y pcre pcre-devel 3、zlib 安

centos安裝nginx

nginx centos iptables firewall 1.yum命令直接安裝yum install nginx系統提示:No package nginx available. Error:Nothing to do說明nginx沒有在源鏡像庫裏,加入nginx源rpm -Uvh htt

centos7安裝FastDFSnginx

FastDFS nginx 1.所需的安裝包: 鏈接:https://pan.baidu.com/s/1Hm48o3aBYn0C7PyWzBGUqw 密碼:kio7 2安裝centos7 2.1Centos7打開網絡的步驟 輸入ifconfig 看本機的網絡ip 輸入vi /etc/sys

centos安裝配置nginx完成之後主機無法訪問

CP 方法 true VM 配置 pre PE all 開啟 原因 VMware中安裝centos7,安裝配置完成nginx後,主機無法訪問。虛擬機沒有放行Nginx默認端口80。 解決方法 解決方法 首先:開啟 web 端口 firewall-cmd --p

FastDFS單節點安裝 & FastDFS+Nginx整合

sysconfig amp key err 查看 location 生產環境 erro info 安裝環境 FastDFS_v5.05.tar.gz(http://sourceforge.net/projects/fastdfs/files/) fastdfs-

CentOS安裝配置Nginx

zxvf queue 重新 如果 6.2 並發連接 div 即使 並且 Nginx 是一個高性能的 Web 和反向代理服務器, 它具有有很多非常優越的特性: 作為 Web 服務器:相比 Apache,Nginx 使用更少的資源,支持更多的並發連接,體現更高的效率,這點使

RHEL/CentOS 安裝 nginx

備份 lin kconfig sql symlink centos mysql gpg chkconfig 采用官方nginx源安裝方法支持的環境 如果不支持,可以改為epel源 系統 版本 支持的平臺 RHEL/CentOS 6.x x86_64, i386

nginx centos 安裝php的gd擴充套件

第一步: 安裝需要用到的庫 yum -y install libjpeglibjpeg-devel libpng libpng-devel freetype freetype-devel 第二步: 進入到php的原始碼目錄下的ext/gd目錄(這裡是原始碼目錄,不是

Linux 安裝FastDFS圖片伺服器以及配合nginx實現圖片檢視

各位同學,今天我們來學習一下如何安裝FastDFS圖片伺服器,首先我們先來介紹一下什麼是圖片伺服器。 1.什麼是FastDFS FastDFS是用c語言編寫的一款開源的分散式檔案系統。FastDFS為網際網路量身定製,充分考慮了冗餘備份、負載均衡、線性擴容等