安装一些必要软件
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