CentOS8安装fastdfs6.06

简介:

一、准备环境

准备如下 tar 包:

fastdfs-6.06.tar.gz
libfastcommon-1.0.43.tar.gz
fastdfs-nginx-module-1.22.tar.gz
nginx-1.17.7.tar.gz

下载地址:

fastdfs-nginx-module,libfastcommon,fastdfs

nginx地址

1、使用 wget 命令下载压缩包,如果没有 wget 命令使用 yum 命令安装

yum install wget

2、下载 fastdfs

wget -c "https://github.com/happyfish100/fastdfs/archive/V6.06.tar.gz" \
-O fastdfs-6.06.tar.gz

3、下载 libfastcommon

wget -c "https://github.com/happyfish100/libfastcommon/archive/V1.0.43.tar.gz" \
-O libfastcommon-1.0.43.tar.gz

4、下载 fastdfs-nginx-module

wget -c "https://github.com/happyfish100/fastdfs-nginx-module/archive/V1.22.tar.gz" \
-O fastdfs-nginx-module-1.22.tar.gz

5、下载 nginx

wget -c http://nginx.org/download/nginx-1.17.7.tar.gz

6、安装编译工具及库文件

yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel

7、测试环境关闭防火墙

systemctl stop firewalld.service

8、开机禁用防火墙

systemctl disable firewalld.service

9、查看防火墙状态

firewall-cmd --state

二、解压并编译安装

1、解压下载好的包

tar -zxvf fastdfs-6.06.tar.gz
tar -zxvf fastdfs-nginx-module-1.22.tar.gz
tar -zxvf libfastcommon-1.0.43.tar.gz
tar -zxvf nginx-1.17.7.tar.gz

2、编译安装

2.1、编译安装 libfastcommon

1、进入解压后的目录

cd /root/download/libfastcommon-1.0.43

2、编译安装

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

3、检查

ls /usr/lib64|grep libfastcommon
ls /usr/lib|grep libfastcommon

出现libfastcommon.so即成功

2.2、编译安装 fastdfs

1、进入解压后的目录

cd /root/download/fastdfs-6.06

2、编译安装

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

3、检查

ls /usr/bin|grep fdfs

4、启用配置文件

cd /etc/fdfs/

cp storage.conf.sample storage.conf

cp client.conf.sample client.conf

cp tracker.conf.sample tracker.conf

mkdir -p /fastdfs/tracker

5、修改 tracker.conf 文件

vi /etc/fdfs/tracker.conf

base_path = /fastdfs/tracker

6、启动 tracker 服务

/etc/init.d/fdfs_trackerd start

7、检查服务是否启动

ps -ef|grep fdfs`

8、修改 storage.conf 文件

vi /etc/fdfs/storage.conf

base_path = /fastdfs/storage store_path0 = /fastdfs/storage

tracker_server = 192.168.0.154:22122
http.server_port = 80

9、创建目录

mkdir -p /fastdfs/storage

10、启动 storage 服务

/etc/init.d/fdfs_storaged start

11、设置开机启动

vi /etc/rc.d/rc.local

加入配置

/etc/init.d/fdfs_trackerd start

/etc/init.d/fdfs_storaged start

12、编辑 client.conf 文件

vi /etc/fdfs/client.conf 

修改

base_path=/fastdfs/tracker

tracker_server=192.168.0.154:22122

2.3、安装 nginx 和 fastdfs-nginx-module

1、安装pcre

yum -y install pcre pcre-devel

2、进入解压目录

cd /root/download/nginx-1.17.7

3、添加 http_stub_status_module 模块

./configure --prefix=/usr/local/nginx --with-http_stub_status_module

4、进入 /root/download/fastdfs-nginx-module-1.22/src/

cd /root/download/fastdfs-nginx-module-1.22/src/

5、编辑配置文件

vi config

6、将config文件中的/usr/local替换成/usr

:%s+/usr/local+/usr

7、进入 nginx 解压目录

cd /root/download/nginx-1.17.7

8、添加fastdfs-nginx-module

./configure --add-module=/root/download/fastdfs-nginx-module-1.22/src/

9、编译安装

make && make install

10、复制并修改fastdfs-ngin-module中的配置文件

cp /root/download/fastdfs-nginx-module-1.22/src/mod_fastdfs.conf /etc/fdfs/
vi /etc/fdfs/mod_fastdfs.conf

修改配置

connect_timeout=10

tracker_server=192.168.0.154:22122
url_have_group_name = true
store_path0=/fastdfs/storage

11、进入fastdfd源码conf目录

cd /root/download/fastdfs-6.06/conf/

11、将http.conf,mime.types两个文件拷贝到/etc/fdfs/目录下

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

12、创建一个软连接,在/fastdfs/storage文件存储目录下创建软连接,将其链接到实际存放数据 的目录

ln -s /fastdfs/storage/data/ /fastdfs/storage/data/M00

13、编辑 nginx 配置

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

修改配置

server {
    listen       80;
    server_name  192.168.0.154;
    location ~/group([0-9])/M00 {
            root  /fastdfs/storage/data;
            ngx_fastdfs_module;
    }
}

14、启动 nginx

/usr/local/nginx/sbin/nginx

三、测试

1、下载测试图片到本地

wget -c "https://gss0.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/zhidao/wh%3D600%2C800/sign=0f6379cdd8ca7bcb7d2ecf298e39475b/42a98226cffc1e17f7efcc3f4590f603738de968.jpg" -O boy.jpg

2、上传测试图片

/usr/bin/fdfs_upload_file /etc/fdfs/client.conf /root/download/boy.jpg

得到返回文件名

group1/M00/00/00/wKgAml4RxbyARj9lAACxR4LEYRg912.jpg

与ip拼接:http://192.168.0.154/group1/M00/00/00/wKgAml4RxbyARj9lAACxR4LEYRg912.jpg

相关文章
|
5天前
|
缓存 Ubuntu Linux
Linux中yum、rpm、apt-get、wget的区别,yum、rpm、apt-get常用命令,CentOS、Ubuntu中安装wget
通过本文,我们详细了解了 `yum`、`rpm`、`apt-get`和 `wget`的区别、常用命令以及在CentOS和Ubuntu中安装 `wget`的方法。`yum`和 `apt-get`是高层次的包管理器,分别用于RPM系和Debian系发行版,能够自动解决依赖问题;而 `rpm`是低层次的包管理工具,适合处理单个包;`wget`则是一个功能强大的下载工具,适用于各种下载任务。在实际使用中,根据系统类型和任务需求选择合适的工具,可以大大提高工作效率和系统管理的便利性。
54 25
|
15天前
|
监控 Linux PHP
【02】客户端服务端C语言-go语言-web端PHP语言整合内容发布-优雅草网络设备监控系统-2月12日优雅草简化Centos stream8安装zabbix7教程-本搭建教程非docker搭建教程-优雅草solution
【02】客户端服务端C语言-go语言-web端PHP语言整合内容发布-优雅草网络设备监控系统-2月12日优雅草简化Centos stream8安装zabbix7教程-本搭建教程非docker搭建教程-优雅草solution
65 20
|
1月前
|
存储 分布式计算 Hadoop
Centos7.9安装kerberos
Centos7.9安装kerberos
86 25
|
1月前
|
存储 Shell 网络安全
Centos7.9安装openldap
Centos7.9安装openldap
58 16
|
1月前
|
数据可视化 Linux 应用服务中间件
Centos7.9安装phpldapadmin
Centos7.9安装phpldapadmin
62 15
|
1月前
|
网络协议 Java 应用服务中间件
centos7环境下tomcat8的安装与配置
本文介绍了在Linux环境下安装和配置Tomcat 8的详细步骤。首先,通过无网络条件下的文件交互软件(如Xftp 6或MobaXterm)下载并解压Tomcat安装包至指定路径,启动Tomcat服务并测试访问。接着,修改Tomcat端口号以避免冲突,并部署Java Web应用项目至Tomcat服务器。最后,调整Linux防火墙规则,确保外部可以正常访问部署的应用。关键步骤包括关闭或配置防火墙、添加必要的端口规则,确保Tomcat服务稳定运行。
|
3月前
|
SQL 存储 Linux
从配置源到数据库初始化一步步教你在CentOS 7.9上安装SQL Server 2019
【11月更文挑战第16天】本文介绍了在 CentOS 7.9 上安装 SQL Server 2019 的详细步骤,包括配置系统源、安装 SQL Server 2019 软件包以及数据库初始化,确保 SQL Server 正常运行。
168 4
|
4月前
|
Linux 网络安全 数据安全/隐私保护
Linux系统之Centos7安装cockpit图形管理界面
【10月更文挑战第12天】Linux系统之Centos7安装cockpit图形管理界面
187 1
Linux系统之Centos7安装cockpit图形管理界面
|
3月前
|
SQL 存储 Linux
从配置源到数据库初始化一步步教你在CentOS 7.9上安装SQL Server 2019
【11月更文挑战第8天】本文介绍了在 CentOS 7.9 上安装 SQL Server 2019 的详细步骤,包括系统准备、配置安装源、安装 SQL Server 软件包、运行安装程序、初始化数据库以及配置远程连接。通过这些步骤,您可以顺利地在 CentOS 系统上部署和使用 SQL Server 2019。
178 1
|
3月前
|
SQL 存储 Linux
从配置源到数据库初始化一步步教你在CentOS 7.9上安装SQL Server 2019
【11月更文挑战第7天】本文介绍了在 CentOS 7.9 上安装 SQL Server 2019 的详细步骤,包括系统要求检查与准备、配置安装源、安装 SQL Server 2019、配置 SQL Server 以及数据库初始化(可选)。通过这些步骤,你可以成功安装并初步配置 SQL Server 2019,进行简单的数据库操作。
108 1

热门文章

最新文章