centos6.2系統下安裝配置FastDFS步驟:html
1:安裝libevent(libevent-2.0.16-stable)nginx
##卸載系統自帶libeventgit
rpm -qa|grep libevent rpm -e libevent*github
##爲Trackerd和Storaged節點節點安裝libeventweb
cd /home/ylhapache
wget https://github.com/downloads/libevent/libevent/libevent-2.0.16-stable.tar.gzvim
tar -zxvf libevent-2.0.16-stable.tar.gzcentos
cd libevent-2.0.16-stable瀏覽器
make clean服務器
./configure
make && make install
##爲libevent建立軟連接到/lib庫下,64位系統對應/lib64
ln -s /usr/local/lib/libevent* /lib/
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:測試
##測試上傳
/usr/local/bin/ fs_test /etc/conf/client.conf upload /home/a.jpg
若是上傳成功回顯信息中有文件的url,在瀏覽器中,輸入url地址, tracker server會自動重定向到存儲文件的storage server,文件下載成功。
至此,已經成功搭建了FastDFS
關於FastDFS的相關配置問題參考: