欢迎来到Vincentyw的博客

该来的终究会来,该走的也一定会离开。凡事都存在前因后果,因缘成熟了,果报便产生了,无法阻挡。
但是发生过了就会消失,有来就有走,一切都是过客,把握自己当下的因缘,承担起自己该承担的责任,做好眼前该做的事情,做的时候尽全力,过去便放下,放下即自在。

FastDFS安装

1、创建本地临时目录

mkdir /pkg
chmod 777 /pkg
cd /pkg

2、创建用户

groupadd apps
useradd -g apps -s /bin/bash fastdfs
echo fastdfs123 | passwd --stdin fastdfs

3、上传需要安装文件

# fastdfs-nginx-module_v1.16.tar.gz
# FastDFS_v5.08.tar.gz
# libfastcommon-master.zip
# nginx-1.10.2.tar.gz

4、安装依赖包

yum install zlib zlib-devel pcre pcre-devel gcc gcc-c++ libevent perl unzip nmap -y

5、安装libfastcommon

unzip libfastcommon-master.zip
cd libfastcommon-master
./make.sh clean
./make.sh
./make.sh install
cd ../

6、安装fastdfs

tar -zxvf FastDFS_v5.08.tar.gz
cd FastDFS
./make.sh clean
./make.sh
./make.sh install
cd ../

7、上传配置文件并修改配置

# 上传配置文件 tracker.conf、storage.conf、client.conf 至 /etc/fdfs
##1.修改storage.conf中 tracker_server 的IP地址
##2.修改storage.conf中 store_path0 地址 /share/share1/fastdfs/storage 使用共享共处
##3.修改storage.conf中 base_path 地址 /home/fastdfs/storage 使用共享共处
##4.修改tracker.conf中 base_path=/home/fastdfs/tracker/
cd conf/
cp tracker.conf storage.conf client.conf /etc/fdfs/
cd ../

8、创建fastdfs目录!!!! 共享存储只需要创建一次

mkdir -p /share/share1/fastdfs/storage
## chown -R fastdfs:apps /share/share1/fastdfs/ 第一次执行

9、测试上传

# 登录fastdfs用户 或者 su - fastdfs
su - fastdfs
mkdir tracker storage

service fdfs_trackerd start
service fdfs_storaged start

# 测试
# /usr/bin/fdfs_upload_file /etc/fdfs/client.conf /pkg/Penguins.jpg
# group1/M00/00/00/CgNhR1jKUCWAKJqKAA1rIuRd3Es988.jpg

10、安装Nginx

tar -zxvf fastdfs-nginx-module_v1.16.tar.gz
cd fastdfs-nginx-module/src
vi config
# CORE_INCS="$CORE_INCS /usr/local/include/fastdfs /usr/local/include/fastcommon/"
# 修改为
# CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
cd ../../

yum install gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib krb5-devel -y
# openssl openssl-devel 需要单独安装

rpm -ivh openssl-devel-1.0.1e-48.el6_8.3.x86_64.rpm

11、安装Nginx

tar -zxvf fastdfs-nginx-module_v1.16.tar.gz
cd fastdfs-nginx-module/src
vi config
# CORE_INCS="$CORE_INCS /usr/local/include/fastdfs /usr/local/include/fastcommon/"
# 修改为
# CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
cd ../../

yum install gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib krb5-devel -y
# openssl openssl-devel 需要单独安装

rpm -ivh openssl-devel-1.0.1e-48.el6_8.3.x86_64.rpm
tar -zxvf nginx-1.10.2.tar.gz
cd nginx-1.10.2
    
./configure  \
--add-module=/pkg/fastdfs-nginx-module/src \
--prefix=/usr/local/nginx \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_realip_module

make && make install
    
cp /pkg/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs

vi /etc/fdfs/mod_fastdfs.conf

#connect_timeout=10
#base_path=/tmp
#tracker_server={ip}:22122
#storage_server_port=23000
#group_name=group1
#url_have_group_name=true
#store_path0=/share/share1/fastdfs/storage
        
cd /pkg/FastDFS/conf/ 
cp http.conf mime.types /etc/fdfs/

12、上传nginx配置文件

#将nginx配置文件nginx.conf 上传到/usr/local/nginx/conf

cp /pkg/conf/nginx.conf /usr/local/nginx/conf/
mkdir -p /log/nginx/8080
chown -R fastdfs:apps /log/nginx
chown -R fastdfs:apps /usr/local/nginx

13、启动nginx 使用fastdfs用户启动nginx

/usr/local/nginx/sbin/nginx

 

posted on 2021-08-24 17:09  VincentYew  阅读(66)  评论(0编辑  收藏  举报

导航