FastDFS-5.11 安装部署 storage

1.安装依赖libfastcommon

cd /usr/local/src/
git clone https://github.com/happyfish100/libfastcommon.git
cd libfastcommon/
./make.sh
./make.sh install

2.安装fastdfs v5.11

cd /usr/local/src
wget https://codeload.github.com/happyfish100/fastdfs/zip/master
unzip master
cd fastdfs-master/
./make.sh
./make.sh install

3. 配置storage

mkdir -p /data/fastdfs/storage
mkdir -p /data/fastdfs/data
cd /etc/fdfs/
cp storage.conf.sample storage.conf

vim /etc/fdfs/storage.conf
disabled=false
group_name=group1
bind_addr=
client_bind=true
port=23000
connect_timeout=30
network_timeout=60
heart_beat_interval=30
stat_report_interval=60
base_path=/data/fastdfs/storage
accept_threads=1
store_path_count=1
store_path0=/data/fastdfs/data
subdir_count_per_path=256
tracker_server=10.1.8.43:22122
tracker_server=10.1.8.44:22122
allow_hosts=*
http.server_port=8888

4.安装依赖

yum install pcre pcre-devel openssl openssl-devel -y
useradd -s /sbin/nologin -M nginx

5.升级openssl

yum install zlib-devel -y

cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz
tar -zxvf openssl-1.0.2k.tar.gz
cd openssl-1.0.2k
./config shared zlib
make
make install

mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
ldconfig -v

6.安装lua依赖环境及软件包

yum -y install epel-release git
yum install -y gcc gcc-c++ zlib zlib-devel openssl openssl-devel pcre pcre-devel gd-devel
yum install -y libpng libjpeg libpng-devel libjpeg-devel ghostscript libtiff libtiff-devel freetype freetype-devel readline-devel ncurses-devel

# 下载组件
cd /usr/local/src
git clone https://github.com/alibaba/nginx-http-concat.git
git clone https://github.com/simpl/ngx_devel_kit.git
git clone https://github.com/openresty/echo-nginx-module.git
git clone https://github.com/openresty/lua-nginx-module.git

# 安装LuaJIT
cd /usr/local/src
#wget http://luajit.org/download/LuaJIT-2.0.4.tar.gz
wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz
tar -zxf LuaJIT-2.0.5.tar.gz
cd LuaJIT-2.0.5
make
make install
export LUAJIT_LIB=/usr/local/lib
export LUAJIT_INC=/usr/local/include/luajit-2.0
ln -s /usr/local/lib/libluajit-5.1.so.2 /lib64/libluajit-5.1.so.2
 
# 安装Lua
cd /usr/local/src
#wget http://www.lua.org/ftp/lua-5.3.1.tar.gz
wget http://www.lua.org/ftp/lua-5.3.4.tar.gz
tar -zxvpf lua-5.3.4.tar.gz
cd lua-5.3.4
make linux && make install

7.安装GM

cd /usr/local/src
#wget ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/1.3/GraphicsMagick-1.3.18.tar.gz
wget ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/1.3/GraphicsMagick-1.3.26.tar.gz
tar -zxvf GraphicsMagick-1.3.26.tar.gz
cd GraphicsMagick-1.3.26
./configure --prefix=/usr/local/GraphicsMagick-1.3.26 --enable-shared
make  && make install
ln -s /usr/local/GraphicsMagick-1.3.26 /usr/local/GraphicsMagick

8.安装nginx

cd /usr/local/src/
git clone https://github.com/happyfish100/fastdfs-nginx-module.git

cd /usr/local/src
wget http://nginx.org/download/nginx-1.12.1.tar.gz
tar -zxvf nginx-1.12.1.tar.gz
cd nginx-1.12.1
./configure --prefix=/usr/local/nginx-1.12.1 \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_realip_module \
--with-openssl=/usr/local/src/openssl-1.0.2k \
--with-http_sub_module \
--with-http_flv_module \
--with-http_dav_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-http_addition_module \
--with-http_image_filter_module \
--with-pcre \
--add-module=../fastdfs-nginx-module/src \
--add-module=../nginx-http-concat \
--add-module=../lua-nginx-module \
--add-module=../ngx_devel_kit \
--add-module=../echo-nginx-module \
--with-ld-opt=-Wl,-rpath,$LUAJIT_LIB

make
make install
ln -sv /usr/local/nginx-1.12.1/ /usr/local/nginx

9.配置fastdfs里nginx配置文件

cd /usr/local/src/fastdfs-nginx-module/src
cp mod_fastdfs.conf /etc/fdfs
cd /usr/local/src/fastdfs-master/conf/
cp anti-steal.jpg http.conf mime.types /etc/fdfs

4.配置mod_fastdfs.conf,配置文件加入	
cd /etc/fdfs/
vim mod_fastdfs.conf
base_path=/data/fastdfs/storage      #保存日志目录
tracker_server=10.10.10.80:22122     #tracker 服务器的 IP 地址以及端口号
storage_server_port=23000            #storage服务器的端口号
group_name=group1                    #当前服务器的group名
url_have_group_name = true           #文件url中是否有group 名
store_path_count=1                   #存储路径个数,需要和store_path 个数匹配
store_path0=/data/fastdfs/data       #存储路径
group_count = 1                      #设置组的个数

10.配置nginx fastsdfs支持

[group1]
group_name=group1
storage_server_port=23000
store_path_count=1
store_path0=/data/fastdfs/data

# nginx配置文件加入	
[root@img02 ~]#vim /usr/local/nginx/conf/nginx.conf
 
        location ~ /group[1-3]/M00 {
                root /data2/;
                ngx_fastdfs_module;
      }
touch /var/log/mod_fastdfs.log
chown nginx.nginx /var/log/mod_fastdfs.log

 

posted @ 2017-07-21 15:31  sunmmi  阅读(1019)  评论(0)    收藏  举报