安裝一些必要軟件
yum -y install wget gcc perl
mkdir ~/zy
cd ~/zy
安裝:libfastcommon
下載:
wget https://codeload.github.com/happyfish100/libfastcommon/tar.gz/V1.0.7
解壓:
tar -zxvf V1.0.7
進入解壓後的目錄
cd libfastcommon-1.0.7/
執行命令
./make.sh
./make.sh install
所以需要創建軟鏈接.
ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so
ln -s /usr/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so
ln -s /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so
cd ..
安裝FastDFS
下載
wget https://codeload.github.com/happyfish100/fastdfs/tar.gz/V5.05
解壓:
tar -zxvf V5.05
執行下面命令不解釋
cd fastdfs-5.05/
./make.sh
./make.sh install
cd /etc/fdfs/
cp tracker.conf.sample tracker.conf
vi /etc/fdfs/tracker.conf文件,修改如下內容
base_path=/tracker
保存
mkdir /tracker
fdfs_trackerd tracker.conf
cp storage.conf.sample storage.conf
修改內容
vi /etc/fdfs/storage.conf
group_name=group1
base_path=/storage
store_path0=/storage
tracker_server=192.168.160.128:22122
mkdir /storage
fdfs_storaged storage.conf
cd ~/zy
解壓fastdfs-nginx-module
wget http://nchc.dl.sourceforge.net/project/fastdfs/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz
tar -zxvf fastdfs-nginx-module_v1.16.tar.gz
vi fastdfs-nginx-module/src/config
修改fastdfs-nginx-module的config文件
原來的內容是
CORE_INCS="$CORE_INCS /usr/local/include/fastdfs /usr/local/include/fastcommon/"
vim /home/nginx/fastdfs-nginx-module/src/config,修改為
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon"
安裝nginx
wget http://nginx.org/download/nginx-1.9.5.tar.gz
yum -y install gcc automake autoconf libtool make gcc-c++ pcre* zlib openssl openssl-devel
mkdir /home/nginx
tar -zxvf nginx-1.9.5.tar.gz
mv fastdfs-nginx-module /home/nginx
cd nginx-1.9.5
./configure \
--prefix=/home/nginx/nginx-1.6.2 \
--sbin-path=/home/nginx/nginx-1.6.2/nginx \
--conf-path=/home/nginx/nginx-1.6.2/nginx.conf \
--pid-path=/home/nginx/nginx-1.6.2/nginx.pid \
--with-http_ssl_module \
--add-module=/home/nginx/fastdfs-nginx-module/src
make -j `cat /proc/cpuinfo | grep processor| wc -l` && make install
cp /home/nginx/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs
vi /etc/fdfs/mod_fastdfs.conf
修改內容
group_name=group1
tracker_server=192.168.160.128:22122
store_path0=/storage
base_path=/storage
cd ~/zy/fastdfs-5.05/conf
cp http.conf mime.types /etc/fdfs/
cd /home/nginx/nginx-1.6.2/
vi nginx.conf
修改Nginx配置文件
location /M00 {
root /storage;
ngx_fastdfs_module;
}
cd /storage/
ln -s data/ M00
/home/nginx/nginx-1.6.2/nginx
vi /etc/sysconfig/iptables
添加
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22122 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 23000 -j ACCEPT
service iptables restart
------------------------------------------------
重啟linux後啟動服務
fdfs_trackerd /etc/fdfs/tracker.conf
fdfs_storaged /etc/fdfs/storage.conf
/home/nginx/nginx-1.6.2/nginx
下載
libfastcommon
https://codeload.github.com/happyfish100/libfastcommon/tar.gz/V1.0.7
fastdfs-nginx-module下載地址
http://nchc.dl.sourceforge.net/project/fastdfs/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz
fastdfs
https://codeload.github.com/happyfish100/fastdfs/tar.gz/V5.05
nginx
http://nginx.org/download/nginx-1.9.5.tar.gz