首页 > 系统相关 >Ubuntu上安装FastDFS

Ubuntu上安装FastDFS

时间:2023-01-29 14:02:30浏览次数:49  
标签:fastdfs FastDFS local nginx usr conf Ubuntu fdfs 安装


①:安装参考链接
②:所需安装包下载链接:
wget https://sourceforge.net/projects/fastdfs/files/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz
wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz
wget https://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gz
​​​ http://nginx.org/download/​​​ ③:ubuntu 编译安装nginx 需要的依赖
sudo apt-get install libpcre3 libpcre3-dev -y
sudo apt-get install openssl libssl-dev -y
sudo apt-get install unzip -y
sudo apt-get install libpcre3 libpcre3-dev -y
sudo apt-get install zlib1g zlib1g-dev -y
sudo apt-get install gcc -y
④:安装libfastcommon
1、下载 libfastcommonV1.0.7.tar.gz到ubuntu机器上;
2、将 libfastcommonV1.0.7.tar.gz解压至/usr/local/下:
3、 tar -zxvf libfastcommonV1.0.7.tar.gz -C /usr/local/
4、 切换目录到:/usr/local/libfastcommon-1.0.7/ 下,接着进行编译和安装;
5、cd /usr/local/libfastcommon-1.0.7/
./make.sh #编译
./make.sh install #安装

6、libfastcommon安装好后会在/usr/lib64 目录下生成 libfastcommon.so 库文件;
cp libfastcommon.so /usr/lib
⑤:安装tracker
1、下载 FastDFS_v5.05.tar.gz 到 ubuntu上;
wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz
2、将FastDFS_v5.05.tar.gz 解压至/usr/local/下
tar -zxvf FastDFS_v5.05.tar.gz -C /usr/local
3、切换目录到: /usr/local/FastDFS/ 下,编译和安装;
cd /usr/local/FastDFS/
./make.sh && ./make.sh install

4、安装成功将安装目录下的conf下的文件拷贝到/etc/fdfs/下;
cp /usr/local/FastDFS/conf/* /etc/fdfs/

5、配置和启动tracker
a、切换目录到: /etc/fdfs/ 目录下;
b、拷贝一份新的tracker配置文件
cp tracker.conf.sample tracker.conf
c、修改tracker.conf ;
vim tracker.conf
base_path=/home/yuqing/fastdfs 改为: base_path=/home/fastdfs
http.server_port 改为: 80
base_path=/home/fastdfs
http.server_port=80 #配置http端口
6、启动tracker,运行如下命令:
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
⑥:配置和启动storage
1、切换目录到: /etc/fdfs/ 目录下;
cd /etc/fdfs/
2、拷贝一份新的storage配置文件
cp storage.conf.sample storage.conf
3、修改storage.conf ;
vim storage.conf
group_name=group1 #配置组名
base_path=/home/yuqing/fastdfs 改为: base_path=/home/fastdfs

#store存放文件的位置(store_path)
store_path0=/home/yuqing/fastdfs 改为: store_path0=/home/fdfs_storage
#如果有多个挂载磁盘则定义多个store_path,如下
#store_path1=…
#store_path2=…
#配置tracker服务器:IP
tracker_server=192.168.172.20:22122
#如果有多个则配置多个tracker
#tracker_server=192.168.101.4:22122

#配置http端口

http.server_port=88

4、创建 /home/fdfs_storage 目录

mkdir /home/fdfs_storage

5、启动storage, 运行命令如下:

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

6、使用FastDFS自带工具测试

a、切换目录到 /etc/fdfs/ 目录下;

cd /etc/fdfs/

b、拷贝一份新的client配置文件

cp client.conf.sample client.conf

d、修改client.conf ;

vim client.conf

修改基本路径和tracker_server如下:

Ubuntu上安装FastDFS_ubuntu


注意:若tracker有多个,可以配置多个,如下:

#tracker_server=…

#tracker_server=…

e、进行测试,运行如下

/usr/bin/fdfs_test /etc/fdfs/client.conf upload /etc/fdfs/a*.png

⑦:FastDFS 和nginx整合

1、在每个tracker上安装nginx,的主要目的是做负载均衡及实现高可用。如果只有一台tracker可以不配置nginx。 一个tracker对应多个storage,通过nginx对storage负载均衡;

2、在storage 上安装nginx

a、下载fastdfs-nginx-module_v1.16.tar.gz 到ubuntu服务器上;

wget https://sourceforge.net/projects/fastdfs/files/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz

b、解压 fastdfs-nginx-module_v1.16.tar.gz 到 /usr/local目录下;

tar -zxvf fastdfs-nginx-module_v1.16.tar.gz -C /usr/local

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

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

d、修改config文件,将文件中的所有 /usr/local/ 路径改为 /usr/

Ubuntu上安装FastDFS_ubuntu_02


修改完成后:

Ubuntu上安装FastDFS_vim_03


e、将fastdfs-nginx-module/src下的mod_fastdfs.conf拷贝至/etc/fdfs/下

cp mod_fastdfs.conf /etc/fdfs/

并修改 /etc/fdfs/mod_fastdfs.conf 的内容;

vi /etc/fdfs/mod_fastdfs.conf

base_path=/tmp 修改为 base_path=/home/fastdfsbase_path=/home/fastdfs

tracker_server=192.168.172.20:22122

#tracker_server=192.168.172.20:22122 #(多个tracker配置多行)

url_have_group_name=true #url中包含group名称

store_path0=/home/fdfs_storage #指定文件存储路径(上面配置的store路径)

f、将libfdfsclient.so拷贝至/usr/lib下

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

g、创建nginx/client目录

mkdir -p /var/temp/nginx/client

⑧:Nginx的安装

1、下载nginx-1.8.0.tar.gz 到ubuntu服务器上;

​​ http://nginx.org/download/​​ 2、解压 nginx-1.8.0.tar.gz 到 /usr/local目录下;

tar -zxvf nginx-1.8.0.tar.gz -C /usr/local/

3、安装nginx的依赖库

sudo apt-get install pcre

sudo apt-get install pcre-devel

sudo apt-get install zlib

sudo apt-get install zlib-devel

sudo apt-get install openssl

sudo apt-get install openssl-devel

sudo apt-get install libpcre3 libpcre3-dev

sudo apt-get install gcc zlib1g-dev

4、进入nginx解压的目录下:

cd /usr/local/nginx-1.8.0/

5、加入模块命令配置

mkdir -p /var/temp/nginx

./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

6、编译并安装

make && make install

安装成功后查看生成的目录,如下所示:

Ubuntu上安装FastDFS_nginx_04


7、拷贝配置文件到 /etc/fdfs 下;

cd /usr/local/FastDFS/conf

cp http.conf mime.types /etc/fdfs/

8、修改nginx配置文件

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

cd /usr/local/nginx/conf/

vim nginx.conf

做如下的修改:

Ubuntu上安装FastDFS_vim_05


Ubuntu上安装FastDFS_Ubuntu上安装FastDFS_06


root /data/fdfs_storage/data;

ngx_fastdfs_module;

说明:

  (a.) server_name指定本机ip;

  (b.) location /group1/M00/:group1为nginx 服务FastDFS的分组名称,M00是FastDFS自动生成编号,对应store_path0=/home/fdfs_storage,如果FastDFS定义store_path1,这里就是M01

9、nginx的启动

cd /usr/local/nginx/sbin/

./nginx

ps -ef | grep nginx

10、防火墙

service iptables stop #临时关闭防火墙

chkconfig iptables off #永久关闭防火墙


标签:fastdfs,FastDFS,local,nginx,usr,conf,Ubuntu,fdfs,安装
From: https://blog.51cto.com/u_15943246/6025728

相关文章

  • 如何安装配置zookeeper
    1:配置java环境修改/etc/bashrc文件,添加JAVA_HOMEcat/etc/bashrcexportJAVA_HOME=/root/jdk-11.0.16.1exportPATH=$PATH:$JAVA_HOME/bin:.2:下载zookeeper​​https://dlc......
  • 使用docker成功安装paddlespeech进行语音识别
    @[TOC]使用docker成功安装paddlespeech进行语音识别多次使用单机安装paddlepaddle及paddlespeech失败后,遇到绝大多数的原因是pyton与paddlespeech不兼容。所以转向了docker......
  • idea maven 安装及卸载本地jar包
    安装:1.打开控制台,切换到maven安装的bin目录2.执行命令 mvninstall:install-file-DgroupId=domain.group-DartifactId=ArtifactId-Dversion=1.0.0.1-Dpackaging=j......
  • CentOS7 安装pycharm
    一、下载pycharm先下载安装包官网地址:https://www.jetbrains.com/pycharm/download/#section=linux   专业版,需要购买,可以试用30天,社区版免费使用没有专业版的一......
  • 做项目安装依赖不免会报错,解决办法。
    webpack中使用npminstall,下载依赖是稍微缓慢,浏览器回应速度,不是那么迅速!在vite中,由于后台开的窗口比较多,进程中的线程比较多,服务器经常会加载失败,所以在路由做跳转时候,......
  • 电脑本地安装不同版本MySQL
    本地已经安装了mysql5.7版本,想测试mysql8版本的用法,想在一台电脑同时配置不同版本的mysql在不同端口号,看起来简单,实现起来其实挺多坑的,总结下实战经验和大家分享下......
  • MAC 安装 Maven & 出现 Unable to import maven project: See logs for details 的解
    转载自:https://wangxin1248.github.io/life/2020/02/mac-install-maven.html转载自:https://blog.csdn.net/weixin_39358657/article/details/106361857=================......
  • ubuntu/centos 优化旧内核
    查看当前的内核uname-sr查看已安装的内核#debian/ubuntu命令:dpkg-l|greplinux-image|awk'{print$2}'#centos命令:rpm-qa|grepkernel一键删除未使用的......
  • 01 STM32CubeIDE 下载安装
    一、链接STM32CubeIDE介绍:https://www.stmcu.com.cn/ecosystem/Cube/STM32CubeIDE STM32CubeIDE下载:https://www.st.com/zh/development-tools/stm32cubeide.html ......
  • docker安装Mysql5.7
    Linuxdocker安装Mysql1.docker镜像地址配置vim/etc/docker/daemon.json2.加入配置信息{"registry-mirrors":["https://wghlmi3i.mirror.aliyuncs.com","https://d......