CentOS7安装fastDFS详细步骤

安装fastDFS

  1. 安装依赖包:yum install -y libevent

  2. 进入安装路径:cd /usr/local

  3. 创建fastDFS文件夹:mkdir fastDFS

  4. 进入fastDFS文件夹:cd fastDFS

  5. 安装libfastcommon-1.0.7.tar.gz

  6. 下载:wget https://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gz

    1. 在linux中执行wget命令提示 -bash: wget: command not found 解决方法yum -y install wget*
  7. 修改名字:mv V1.0.7.tar.gz libfastcommon-1.0.7.tar.gz

  8. 解压:tar zxvf libfastcommon-1.0.7.tar.gz

  9. 进入解压后目录:cd libfastcommon-1.0.7/

  10. 编译:./make.sh

  11. 执行./make.sh发生以下报错:

    1. 执行这条命令(无管理员权限): sudo yum install gcc

    2. 执行这条命令(有管理员权限):yum install gcc

    3. sudo yum install gcc
      
  12. 安装:./make.sh install

    1. fastDFS安装时,./make.sh编译时出错—perl:未找到命令

    2. yum install gcc  / sudo yum install gcc
      
  13. 创建目录

       mkdir -p /home/fdfsdata/tracker
       mkdir -p /home/fdfsdata/storage/files
       mkdir -p /home/fdfsdata/storage/data_log
    
  14. 配置 tracker 服务

    cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
    
  15. 编辑:vim /etc/fdfs/tracker.conf
    修改base_path/home/fdfsdata/tracker

  16. 启动 tracker 服务:/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
    重启 tracker 服务:/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart

  17. 配置 storage 服务

    cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
    
  18. 编辑:vim /etc/fdfs/storage.conf
    修改base_path/home/fdfsdata/storage/data_log
    修改store_path0/home/fdfsdata/storage/files
    修改tracker_server=192.168.1.33:22122

  19. 启动 storage 服务:/usr/bin/fdfs_storaged /etc/fdfs/storage.conf
    重启 storage 服务:/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart

  20. cd /usr/local
    下载Nginx:wget http://nginx.org/download/nginx-1.11.8.tar.gz
    下载Nginx插件:wget http://jaist.dl.sourceforge.NET/project/fastdfs/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz
    解压 Nginx 模块:tar zxvf fastdfs-nginx-module_v1.16.tar.gz,
    编辑 Nginx 模块的配置文件:vim /usr/local/fastdfs-nginx-module/src/config

    CORE_INCS="$CORE_INCS /usr/local/include/fastdfs /usr/local/include/fastcommon/" 
    修改为CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
    
  21. cp /usr/local/fastDFS/fastdfs-5.05/conf/http.conf /etc/fdfs
    cp /usr/local/fastDFS/fastdfs-5.05/conf/mime.types /etc/fdfs
    
  22. yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
    ------------------------------------------------------------------------------
    mkdir -p /usr/local/nginx /var/log/nginx /var/temp/nginx /var/lock/nginx
    ------------------------------------------------------------------------------
    cd nginx-1.11.8
    
  23. ./configure --prefix=/usr/local/nginx --pid-path=/var/local/nginx/nginx.pid --lock-path=/var/lock/nginx/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_gzip_static_module --http-client-body-temp-path=/var/temp/nginx/client --http-proxy-temp-path=/var/temp/nginx/proxy --http-fastcgi-temp-path=/var/temp/nginx/fastcgi --http-uwsgi-temp-path=/var/temp/nginx/uwsgi --http-scgi-temp-path=/var/temp/nginx/scgi --add-module=/usr/local/fastdfs-nginx-module/src
    
  24. make && make install

  25. cp /usr/local/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs

  26. mkdir -p /home/fastdfsdata/nginx/data-and-log

  27. vim /etc/fdfs/mod_fastdfs.conf

  28. 编辑base_path=/home/fastdfsdata/nginx/data-and-log
    编辑tracker_server=192.168.1.33:22122
    编辑store_path0=/home/fdfsdata/storage/files
    编辑url_have_group_name = true

  29. vi /usr/local/nginx/conf/nginx.conf

  30. location ~/group([0-9])/M00 {
                ngx_fastdfs_module;
            }
            
    
  31. 启动nginx: 进入nginx中的sbin中./nginx -s reload

  32. 连接时遇到问题,大部分是因为没有剋期23000端口导致的,可以关闭防火墙就可以正常访问了

  • 错误原因:在执行make.sh的时候没有找到相应的命令

  • 解决办法:安装相应的命令即可。执行以下命令

    yum -y install zlib zlib-devel pcre pcre-devel gcc gcc-c++ openssl openssl-devel libevent libevent-devel perl unzip net-tools wget  
    

你可能感兴趣的:(Linux,CentOS7)