离线安装包准备:

将相关的安装包上传到 /usr/local 目录,安装包下载

并解压到当前目录

1.安装 gcc

yum install -y gcc gcc-c++

2.安装 perl

yum install -y perl

 3.安装 libevent

yum install -y libevent

4.安装 libfastcommon

libfastcommon 没有 yum 源,通过上传的安装包进行编译与安装

cd /usr/local/libfastcommon-1.0.7/

./make.sh && ./make.sh install

libfastcommon 安装好后会在 /usr/lib64 目录下生成  libfastcommon.so 库文件

由于 FastDFS 程序引用 usr/lib 目录所以需要将 /usr/lib64 下的库文件拷贝至 /usr/lib 下

cp /usr/lib64/libfastcommon.so /usr/lib

5.安装 tracker

cd /usr/local/fastdfs-5.05/

./make.sh && ./make.sh install

安装成功将安装目录下的 conf 下的文件拷贝到 /etc/fdfs/ 下

cp conf/* /etc/fdfs/

 6.配置和启动 tracker

切换到 /etc/fdfs 目录下

cd /etc/fdfs

修改 tracker.conf

vi tracker.conf

base_path = /home/fastdfs
http.server_port = 80

创建 /home/fastdfs 目录

mkdir -p /home/fastdfs

启动 tracker

/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart

PS:启动成功后,在 /home/fastdfs/ 目录下生成两个目录, 一个是数据,一个是日志

 7.配置和启动 storage

切换到 /etc/fdfs 目录下

cd /etc/fdfs

修改 tracker.conf

vi storage.conf

base_path = /home/fastdfs
store_path0 = /home/fdfs_storage
tracker_server = x.x.x.x:22122 (根据实际情况改)
http.server_port = 88

创建 /home/fdfs_storage 目录

mkdir -p /home/fdfs_storage

启动 storage

/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart

PS:启动成功后,在 /home/fdfs_storage/data 目录下生成以下显示目录

8.测试FastDFS上传文件

切换到 /etc/fdfs 目录下

cd /etc/fdfs

修改 client.conf

vi client.conf

base_path = /home/fastdfs
tracker_server = x.x.x.x:22122 (根据实际情况改)

拷贝一张图片 test.jpg 到Centos服务器上的 /tmp 目录下

进行上传测试

/usr/bin/fdfs_test /etc/fdfs/client.conf upload /tmp/test.jpg

PS:由于现在还没有和nginx整合无法使用http下载

9.FastDFS 和Nginx整合

切换到 /usr/local/fastdfs-nginx-module/src 目录下

cd /usr/local/fastdfs-nginx-module/src/

修改config文件

vi config

将文件中的所有 /usr/local/ 路径改为 /usr/

复制当前目录下的 mod_fastdfs.conf 文件到 /etc/fdfs/ 目录下

cp mod_fastdfs.conf /etc/fdfs/

切换到 /etc/fdfs 目录,修改 mod_fastdfs.conf 文件

vi mod_fastdfs.conf

base_path=/home/fastdfs
tracker_server=x.x.x.x:22122(根据实际情况改)
url_have_group_name=true #url中包含group名称
store_path0=/home/fdfs_storage #指定文件存储路径(上面配置的store路径)

将 /usr/lib64 目录下的 libfdfsclient.so 文件拷贝至 /usr/lib 目录下

cp /usr/lib64/libfdfsclient.so /usr/lib

10.Nginx 的安装

安装nginx的依赖库:

yum install -y pcre pcre-devel

yum install -y zlib zlib-devel

yum install -y openssl openssl-devel

创建 /var/temp/nginx/client 目录

mkdir -p /var/temp/nginx/client

切换到 nginx 解压的目录
cd /usr/local/nginx-1.8.0/

执行以下配置命令:

./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/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

编译并安装

make && make install

PS:安装成功后查看生成的目录

创建 /usr/local/nginx/logs 目录

mkdir /usr/local/nginx/logs

切换到 /usr/local/nginx/conf/ 目录

cd /usr/local/nginx/conf/

修改 nginx.conf 文件

vi nginx.conf

切换到  /usr/local/nginx/sbin/ 目录

cd /usr/local/nginx/sbin/

启动 nginx

./nginx

查看 nginx 进程

放通防火墙80(nginx)、22122(tracker)、23000(storage)端口

firewall-cmd --zone=public --add-port=80/tcp --permanent

firewall-cmd --zone=public --add-port=22122/tcp --permanent

firewall-cmd --zone=public --add-port=23000/tcp --permanent

firewall-cmd --reload

这时已经可以通过浏览器访问刚刚测试上传的图片 test.jpg!

11.FastDFS 和 Nginx 开机自启配置

编辑 /etc/rc.d/rc.local 文件,增加启动项

vi /etc/rc.d/rc.local

# fastdfs start
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart

# nginx start
/usr/local/nginx/sbin/nginx

给rc.local 文件增加可执行的权限

chmod +x /etc/rc.d/rc.local

Centos7安装FastDFS的更多相关文章

  1. CentOS7 安装FastDFS分布式文件系统

    CentOS7 安装FastDFS分布式文件系统 最近要用到fastDFS,所以自己研究了一下,在搭建FastDFS的过程中遇到过很多的问题,为了能帮忙到以后搭建FastDFS的同学,少走弯路,与大家 ...

  2. CentOS7 安装FastDFS单机版

    1. 下载 FastDFS https://github.com/happyfish100/fastdfs/releases libfastcommon https://github.com/happ ...

  3. 阿里云服务器Centos7安装FastDFS(一)

    安装步骤一 安装FastDFS需要安装:gcc.libevent.libfastcommon.FastDFS(包括tracker和storage) 安装gcc 判断是否安装了gcc gcc -V 如果 ...

  4. Centos7 单节点安装 FastDFS + FastDHT服务

    Centos7 单节点安装 FastDFS + FastDHT服务 1.安装gcc(编译时需要) FastDFS是C语言开发,安装FastDFS需要先将官网下载的源码进行编译,编译依赖gcc环境,如果 ...

  5. Centos7 上安装FastDFS

    Centos7 上安装 FastDFS 本文章摘抄于 风止鱼歇  博客地址:https://www.cnblogs.com/yufeng218/p/8111961.html 1.安装gcc(编译时需要 ...

  6. centos7.x 安装 fastDFS

    环境准备 使用的系统软件 名称 说明 centos 7.x libfatscommon FastDFS分离出的一些公用函数包 FastDFS FastDFS本体 fastdfs-nginx-modul ...

  7. Centos7 上安装 FastDFS

    1.安装gcc(编译时需要) FastDFS是C语言开发,安装FastDFS需要先将官网下载的源码进行编译,编译依赖gcc环境,如果没有gcc环境,需要安装gcc yum install -y gcc ...

  8. CentOS7搭建FastDFS V5.11分布式文件系统-第二篇

    1.CentOS7 FastDFS搭建 前面已下载好了要用到的工具集,下面就可以开始安装了: 如果安装过程中出现问题,可以下载我提供的,当前测试可以通过的工具包: 点这里点这里 1.1 安装libfa ...

  9. 安装FastDFS+Nginx

    安装FastDFS FastDFS开发者的GitHub地址为:https://github.com/happyfish100 打开上述链接,我们点击fastdfs–>release,发现最新版的 ...

随机推荐

  1. .NET开源工作流RoadFlow-表单设计-HTML编辑器

    roadflow目前采用的html编辑器为ueditor编辑器(和表单设计器的编辑器相同). 绑定字段:与数据表的某个字段对应. 宽度:编辑器的宽度. 高度:编辑器的高度. 运行效果如下:

  2. JSP初学者4

    Filter可认为是Servlet的“加强版”,他主要用于对用户请求进行预处理,也可以对HttpServletResponse进行后处理,是个典型的 处理链. 使用Filter完整的流程是:Filte ...

  3. Android中的Service与进程间通信(IPC)详解

    Service 什么是Service 在后台长期运行的没有界面的组件.其他组件可以启动Service让他在后台运行,或者绑定Service与它进行交互,甚至实现进程间通信(IPC).例如,可以让服务在 ...

  4. 关于httpclient的终结

    End of life 关于Commons HttpClient项目现在已经结束,不再开发.它已经被HttpClient和HttpCore模块中的ApacheHttpComponents项目所取代,新 ...

  5. mantis统计报表和图形报表出现乱码问题的解决方法

    Mantis 报表中文乱码 1.安装Mantis图表 1.0插件 administrator登录-------管理------插件管理,安装插件 2.上传字体simhei.ttf  simsun.tt ...

  6. C# Process.WaitForExit()与死锁

    前段时间遇到一个问题,搞得焦头烂额,现在记录下来,希望对大家有所帮助. 程序里我使用Process类启动命令行,执行批处理文件 'Create.cmd'(当我手工将此文件拖入命令行执行时,一切正常). ...

  7. mybatis 中map作为参数

    public interface ICodeGenDao extends IBaseDao<AssetsAllocation, Long> { /*** * 生成主编码 * @param ...

  8. Wi-Fi

    AP就是一个无线的交换机,提供无线信号发射接收的功能 Wi-Fi是一种可以将个人电脑.手持设备(如PDA.手机)等终端以无线方式互相连接的技术 两个不一样的东西,无法比较的 你说的应该是无线路由器和无 ...

  9. jQuery插件编写步骤详解

    如今做web开发,jquery 几乎是必不可少的,就连vs神器在2010版本开始将Jquery 及ui 内置web项目里了.至于使用jquery好处这里就不再赘述了,用过的都知道.今天我们来讨论下jq ...

  10. ubuntu 14.04 64位使用google官方android开发集成工具adt-64位无法使用adb

    在使用ubuntu64位(14.04)时,下载来一个adt-bundle-linux-x86_64-20131030.zip,但是运行时报错: Android: Gradle: Execution f ...