当前位置: 首页 > news >正文

ubuntu server 22.04安装 fdfs

ubuntu server 22.04安装 fdfs

安装依赖包

sudo apt -y install gcc g++ make pcre2-utils libpcre2-dev openssl libssl-dev zlib1g zlib1g-dev libxml2-utils libxml2 libxml2-dev libxslt-dev libgd-dev libgeoip-dev libgoogle-perftools-dev libperl-dev

下载相关软件包

sudo mkdir -p /opt/fastdfs /data/fastdfs /data/fastdfs/data01
cd /opt/fastdfs下载如下软件包
libfastcommon-1.0.40.tar.gz
fastdfs-5.12.tar.gz
fastdfs-nginx-module-1.20.tar.gz

安装libfastcommon

cd /opt/fastdfs
sudo tar -zxvf libfastcommon-1.0.40.tar.gz
cd libfastcommon-1.0.40/
sudo ./make.sh
sudo ./make.sh install

安装fastdfs

cd /opt/fastdfs
sudo tar -zxvf fastdfs-5.12.tar.gz
cd fastdfs-5.12
sudo ./make.sh
sudo ./make.sh install
sudo cp conf/* /etc/fdfs/
sudo cp /opt/fastdfs/fastdfs-nginx-module-1.20/src/mod_fastdfs.conf /etc/fdfs

防火墙端口

sudo firewall-cmd --zone=public --add-port=22122/tcp --permanent
sudo firewall-cmd --zone=public --add-port=23000/tcp --permanent
sudo firewall-cmd --zone=public --add-port=8888/tcp --permanent
sudo firewall-cmd --reload

安装nginx

修改/opt/fastdfs/fastdfs-nginx-module-1.20/src/config文件,在从1处重新配置
ngx_module_incs="/usr/local/include /usr/include/fastdfs /usr/include/fastcommon"
CORE_INCS="$CORE_INCS /usr/local/include /usr/include/fastdfs /usr/include/fastcommon"CFLAGS的两行增加如下参数:
-Wformat-truncation=0 -Wformat-overflow=0sudo groupadd nginx
sudo useradd -g nginx nginx -s /sbin/nologin
sudo mkdir -p /usr/local/nginx/tmp/
sudo chown -R nginx:nginx /usr/local/nginx/
cd nginx-1.25.5/sudo ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-file-aio  --with-http_auth_request_module --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module --add-module=/opt/fastdfs/fastdfs-nginx-module-1.20/src/sudo make && sudo make install

修改nginx配置

cd /usr/local/nginx/conf
sudo mv nginx.conf nginx.conf.bak
sudo vim /usr/local/nginx/conf/nginx.confworker_processes  1;
events {worker_connections  1024;
}http {include       mime.types;default_type  application/octet-stream;sendfile        on;keepalive_timeout  65;gzip  on;server {## 该端口为storage.conf中的http.server_port相同listen       8888;server_name  localhost;location / {root   html;index  index.html index.htm;}location ~/shuan/ {root /data/fastdfs/storaged/data01;ngx_fastdfs_module;}error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}}
}

设置nginx服务文件

sudo vim /usr/lib/systemd/system/nginx.service
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target

启动nginx服务

sudo chown -R nginx.nginx /usr/local/nginx
sudo systemctl enable nginx
sudo systemctl start nginx
sudo systemctl status nginx

防火墙放行8888端口

sudo firewall-cmd --permanent --zone=public --add-port=8888/tcp
sudo firewall-cmd --reload

配置tracker

sudo vim /etc/fdfs/tracker.confport=22122
base_path=/data/fastdfs/trackerd
store_group=shuan
use_storage_id = true

配置storage

sudo vim /etc/fdfs/storage.confgroup_name=shuan
port=23000
base_path=/data/fastdfs/storaged
store_path0=/data/fastdfs/storaged/data01
tracker_server=192.168.200.12:22122
http.server_port=8888

配置storage_ids

sudo vim /etc/fdfs/storage_ids.conf100001   shuan  192.168.200.12

配置client

sudo vim /etc/fdfs/client.confbase_path=/data/fastdfs/trackerd
tracker_server=192.168.200.12:22122
use_storage_id = true

配置nginx

sudo vim /etc/fdfs/mod_fastdfs.confuse_storage_id = true
tracker_server=192.168.200.12:22122
group_name=shuan
url_have_group_name = true
store_path_count=1
store_path0=/data/fastdfs/storaged/data01
group_count = 1[group1]
group_name=shuan
storage_server_port=23000
store_path_count=1
store_path0=/data/fastdfs/storaged/data01

创建tracker和storaged配置文件中的目录(不提前创建启动报错)

sudo mkdir -p /data/fastdfs/trackerd
sudo mkdir -p /data/fastdfs/storaged
sudo mkdir -p /data/fastdfs/storaged/data01/data 

加载tracker与storage服务配置文件,并设置开机自启

sudo systemctl daemon-reloadsudo systemctl start fdfs_trackerd
sudo systemctl enable fdfs_trackerdsudo systemctl start fdfs_storaged
sudo systemctl enable fdfs_storagedsudo systemctl restart fdfs_storaged
sudo systemctl restart fdfs_trackerdsudo systemctl status fdfs_storaged
sudo systemctl status fdfs_trackerd

防火墙放行8888端口

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

查看集群状态,可指定tracker地址查看

fdfs_monitor /etc/fdfs/client.conf
fdfs_monitor /etc/fdfs/client.conf -h 192.168.200.12 list

文件上传测试

fdfs_upload_file /etc/fdfs/client.conf /opt/fastdfs/nginx-1.25.5.tar.gz
shuan/M00/00/00/wKjIDGZzpo6AbrV9ABL7nN6W2_U.tar.gz

下载测试

http://192.168.200.12:8888/shuan/M00/00/00/wKjIDGZzpo6AbrV9ABL7nN6W2_U.tar.gz

相关文章:

  • 上海国际嵌入式展 - 基于树莓派5和CODESYS的16轴运动控制解决方案
  • <Python><paddleocr>基于python使用百度paddleocr实现图片文字识别与替换
  • 前后端分离的后台管理系统源码,快速开发OA、CMS网站后台管理、毕业设计项目
  • android 一个manifest 可以有 多个 hal 吗 ?
  • Leetcode211. 添加与搜索单词 - 数据结构设计
  • 【机器学习 复习】第3章 K-近邻算法
  • JavaWeb——Mysql的启动/登录/卸载
  • Netty中的Reactor模型实现
  • 什么是ETL?
  • 内容安全复习 3 - 深度学习基础
  • 数据仓库之Hive
  • Function Calling, ReAct, 以及插件机制的区别与应用
  • Lambda 表达式是为了解决啥问题,语法,使用规则,c++中的常用用法示例
  • JVS开源底座与核心引擎的全方位探索,助力IT智能、高效、便捷的进化
  • ffmpeg windows系统详细教程
  • 《网管员必读——网络组建》(第2版)电子课件下载
  • Centos6.8 使用rpm安装mysql5.7
  • es6要点
  • es的写入过程
  • Fundebug计费标准解释:事件数是如何定义的?
  • Rancher-k8s加速安装文档
  • Spark in action on Kubernetes - Playground搭建与架构浅析
  • ucore操作系统实验笔记 - 重新理解中断
  • Vue 重置组件到初始状态
  • Yeoman_Bower_Grunt
  • Yii源码解读-服务定位器(Service Locator)
  • 从伪并行的 Python 多线程说起
  • 计算机在识别图像时“看到”了什么?
  • 技术攻略】php设计模式(一):简介及创建型模式
  • 技术胖1-4季视频复习— (看视频笔记)
  • 解析带emoji和链接的聊天系统消息
  • 每天10道Java面试题,跟我走,offer有!
  • 爬虫模拟登陆 SegmentFault
  • 深度学习入门:10门免费线上课程推荐
  • 一个普通的 5 年iOS开发者的自我总结,以及5年开发经历和感想!
  • 原生 js 实现移动端 Touch 滑动反弹
  • Spring第一个helloWorld
  • ​Base64转换成图片,android studio build乱码,找不到okio.ByteString接腾讯人脸识别
  • ​LeetCode解法汇总2670. 找出不同元素数目差数组
  • ‌内网穿透技术‌总结
  • # 移动硬盘误操作制作为启动盘数据恢复问题
  • #鸿蒙生态创新中心#揭幕仪式在深圳湾科技生态园举行
  • #每天一道面试题# 什么是MySQL的回表查询
  • $(document).ready(function(){}), $().ready(function(){})和$(function(){})三者区别
  • (1)SpringCloud 整合Python
  • (3)Dubbo启动时qos-server can not bind localhost22222错误解决
  • (C#)Windows Shell 外壳编程系列9 - QueryInfo 扩展提示
  • (Pytorch框架)神经网络输出维度调试,做出我们自己的网络来!!(详细教程~)
  • (附源码)springboot“微印象”在线打印预约系统 毕业设计 061642
  • (附源码)springboot车辆管理系统 毕业设计 031034
  • (附源码)基于SSM多源异构数据关联技术构建智能校园-计算机毕设 64366
  • (附源码)计算机毕业设计SSM智慧停车系统
  • (转)fock函数详解
  • (转)菜鸟学数据库(三)——存储过程
  • (转)大型网站的系统架构