uos服务器系统源码安装Fastdfs

一、安装libfastcommon库

1.下载

[root@host-192-168-0-249 ~]# cd /opt

[root@host-192-168-0-249 opt]# mkdir fastdfs-server

[root@host-192-168-0-249 fastdfs-server]# wget https://github.com/happyfish100/libfastcommon/archive/refs/tags/V1.0.59.zip

2.安装

[root@host-192-168-0-249 fastdfs-server]# unzip V1.0.59.zip 
[root@host-192-168-0-249 fastdfs-server]# cd libfastcommon-1.0.59/
[root@host-192-168-0-249 libfastcommon-1.0.59]# ./make.sh 
[root@host-192-168-0-249 libfastcommon-1.0.59]# ./make.sh install

3.创建软链接

# ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
# ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so
# ln -s /usr/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so
# ln -s /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so 

二、安装fastdfs

1.下载

[root@host-192-168-0-249 libfastcommon-1.0.59]# cd /opt/fastdfs-server/
[root@host-192-168-0-249 libfastcommon-1.0.59]# wget https://github.com/happyfish100/fastdfs/archive/refs/tags/V6.08.zip

2.安装

[root@host-192-168-0-249 fastdfs-server]# unzip V6.08.zip 
[root@host-192-168-0-249 fastdfs-6.08]# cd fastdfs-6.08/
[root@host-192-168-0-249 fastdfs-6.08]# ./make.sh 
[root@host-192-168-0-249 fastdfs-6.08]# ./make.sh install

3.创建软链接

# ln -s /usr/bin/fdfs_trackerd   /usr/local/bin
# ln -s /usr/bin/fdfs_storaged   /usr/local/bin
# ln -s /usr/bin/stop.sh         /usr/local/bin
# ln -s /usr/bin/restart.sh      /usr/local/bin

三、配置tracker

[root@host-192-168-0-249 fdfs]# cd /etc/fdfs/
[root@host-192-168-0-249 fdfs]# ll
总用量 96
-rw-r--r-- 1 root root 23981 815 13:33 anti-steal.jpg
-rw-r--r-- 1 root root  1915 815 11:37 client.conf
-rw-r--r-- 1 root root   965 815 13:33 http.conf
-rw-r--r-- 1 root root 31172 815 13:33 mime.types
-rw-r--r-- 1 root root  3737 815 13:31 mod_fastdfs.conf
-rw-r--r-- 1 root root 10256 815 11:34 storage.conf
-rw-r--r-- 1 root root   620 815 11:17 storage_ids.conf
-rw-r--r-- 1 root root  9145 815 11:21 tracker.conf

[root@host-192-168-0-249 fdfs]# vi tracker.conf 
# is this config file disabled
# false for enabled
# true for disabled
disabled = false

# the tracker server port
port = 22122

# the base path to store data and log files
base_path = /opt/fastdfs-server/tracker

# HTTP port on this tracker server
http.server_port = 8888

创建目录
[root@host-192-168-0-249 fdfs]# mkdir -p /opt/fastdfs-server/tracker

关闭防火墙
[root@host-192-168-0-249 fdfs]# systemctl stop firewalld.service

启动tracker服务
[root@host-192-168-0-249 fdfs]# systemctl start fdfs_trackerd.service 
[root@host-192-168-0-249 fdfs]# netstat -anp | grep fdfs
tcp        0      0 0.0.0.0:22122           0.0.0.0:*               LISTEN      53024/fdfs_trackerd   

四、配置fastdfs Storage

[root@host-192-168-0-249 fastdfs-server]# mkdir  -p /opt/fastdfs-server/storage

[root@host-192-168-0-249 fdfs]# cd /etc/fdfs/
[root@host-192-168-0-249 fdfs]# ll
总用量 96
-rw-r--r-- 1 root root 23981 815 13:33 anti-steal.jpg
-rw-r--r-- 1 root root  1915 815 11:37 client.conf
-rw-r--r-- 1 root root   965 815 13:33 http.conf
-rw-r--r-- 1 root root 31172 815 13:33 mime.types
-rw-r--r-- 1 root root  3737 815 13:31 mod_fastdfs.conf
-rw-r--r-- 1 root root 10256 815 11:34 storage.conf
-rw-r--r-- 1 root root   620 815 11:17 storage_ids.conf
-rw-r--r-- 1 root root  9145 815 16:59 tracker.conf

[root@host-192-168-0-249 fdfs]# vi storage.conf 
# the base path to store data and log files
# NOTE: the binlog files maybe are large, make sure
#       the base path has enough disk space,
#       eg. the disk free space should > 50GB
base_path = /opt/fastdfs-server/storage

# store_path#, based on 0, to configure the store paths to store files
# if store_path0 not exists, it's value is base_path (NOT recommended)
# the paths must be exist.
#
# IMPORTANT NOTE:
#       the store paths' order is very important, don't mess up!!!
#       the base_path should be independent (different) of the store paths

store_path0 = /opt/fastdfs-server/storage

# tracker_server can ocur more than once for multi tracker servers.
# the value format of tracker_server is "HOST:PORT",
#   the HOST can be hostname or ip address,
#   and the HOST can be dual IPs or hostnames seperated by comma,
#   the dual IPS must be an inner (intranet) IP and an outer (extranet) IP,
#   or two different types of inner (intranet) IPs.
#   for example: 192.168.2.100,122.244.141.46:22122
#   another eg.: 192.168.1.10,172.17.4.21:22122

tracker_server = 192.168.0.249:22122
tracker_server = 192.168.0.249:22122

# the port of the web server on this storage server
http.server_port = 8888

启动服务
[root@host-192-168-0-249 fdfs]# systemctl start fdfs_storaged.service 

五、安装nginx

[root@host-192-168-0-249 opt]# cd /opt/
wget  https://nginx.org/download/nginx-1.23.1.tar.gz
[root@host-192-168-0-249 opt]# tar xvf nginx-1.23.1.tar.gz 
[root@host-192-168-0-249 opt]# wget https://github.com/happyfish100/fastdfs-nginx-module/archive/refs/tags/V1.22.zip
[root@host-192-168-0-249 opt]# unzip V1.22.zip 
[root@host-192-168-0-249 opt]# cd nginx-1.23.1/
[root@host-192-168-0-249 nginx-1.23.1]# ./configure --add-module=/opt//opt/fastdfs-nginx-module-1.22/src
[root@host-192-168-0-249 nginx-1.23.1]# make -j 10 && make install 

查看版本
[root@host-192-168-0-249 nginx-1.23.1]#  /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.23.1
built by gcc 8.4.1 20200928 (UOS 8.4.1-1) (GCC) 

六、配置fastdfs-nginx-module模块

[root@host-192-168-0-249 opt]# cd fastdfs-nginx-module-1.22/src/
[root@host-192-168-0-249 src]# cp mod_fastdfs.conf /etc/fdfs/
[root@host-192-168-0-249 src]# vi /etc/fdfs/mod_fastdfs.conf 


# FastDFS tracker_server can ocur more than once, and tracker_server format is
#  "host:port", host can be hostname or ip address
# valid only when load_fdfs_parameters_from_tracker is true
tracker_server=192.168.0.249:22122

# the port of the local storage server
# the default value is 23000
storage_server_port=23000

# if the url / uri including the group name
# set to false when uri like /M00/00/00/xxx
# set to true when uri like ${group_name}/M00/00/00/xxx, such as group1/M00/xxx
# default value is false
url_have_group_name = true

# store_path#, based 0, if store_path0 not exists, it's value is base_path
# the paths must be exist
# must same as storage.conf
store_path0=/opt/fastdfs-server/storage

七、配置nginx监听端口

[root@host-192-168-0-249 src]# vi /usr/local/nginx/conf/nginx.conf

    server {
        listen       8888;
        server_name  localhost;

		在server 里面添加如下内容
        location /group1/M00 {
             alias /opt/fastdfs-server/storage/data;
              autoindex on;
              ngx_fastdfs_module;
        	}
        }
启动nginx
[root@host-192-168-0-249 src]# /usr/local/nginx/sbin/nginx 

八、测试上传

修改tracker客户端配置文件

[root@host-192-168-0-249 src]# cd /etc/fdfs/
[root@host-192-168-0-249 fdfs]# ll
总用量 96
-rw-r--r-- 1 root root 23981 815 13:33 anti-steal.jpg
-rw-r--r-- 1 root root  1915 815 11:37 client.conf
-rw-r--r-- 1 root root   965 815 13:33 http.conf
-rw-r--r-- 1 root root 31172 815 13:33 mime.types
-rw-r--r-- 1 root root  3737 815 13:31 mod_fastdfs.conf
-rw-r--r-- 1 root root 10256 815 11:34 storage.conf
-rw-r--r-- 1 root root   620 815 11:17 storage_ids.conf
-rw-r--r-- 1 root root  9145 815 16:59 tracker.conf

[root@host-192-168-0-249 fdfs]# vi client.conf
# the base path to store log files
base_path = /opt/fastdfs-server/client

# tracker_server can ocur more than once for multi tracker servers.
# the value format of tracker_server is "HOST:PORT",
#   the HOST can be hostname or ip address,
#   and the HOST can be dual IPs or hostnames seperated by comma,
#   the dual IPS must be an inner (intranet) IP and an outer (extranet) IP,
#   or two different types of inner (intranet) IPs.
#   for example: 192.168.2.100,122.244.141.46:22122
#   another eg.: 192.168.1.10,172.17.4.21:22122

tracker_server = 192.168.0.249:22122
tracker_server = 192.168.0.249:22122


[root@host-192-168-0-249 fastdfs-server]# cd /opt/fastdfs-server/
[root@host-192-168-0-249 fastdfs-server]# ll
总用量 4700
-rw-r--r--  1 root root 1885674 815 13:43 1.jpg
-rw-r--r--  1 root root 1631019 815 16:29 2.jpg
drwxr-xr-x  2 root root      19 815 11:40 client
drwxr-xr-x 13 root root     322 33 10:46 fastdfs-6.08
drwxr-xr-x  3 root root      47 1119 2019 fastdfs-nginx-module
drwxr-xr-x  6 root root     199 815 11:13 libfastcommon-1.0.59
drwxr-xr-x  4 root root      30 815 11:34 storage
drwxr-xr-x  4 root root      30 815 11:23 tracker
-rw-r--r--  1 root root  348138 815 11:09 V1.0.59.zip
-rw-r--r--  1 root root   22297 815 11:45 V1.22.zip
-rw-r--r--  1 root root  913521 815 11:14 V6.08.zip

上传文件命令:
[root@host-192-168-0-249 fastdfs-server]# /usr/bin/fdfs_upload_file /etc/fdfs/client.conf 2.jpg
group1/M00/00/00/wKgA-WL7LFSAcXFIABjjK0nS-NU415.jpg
将/opt/fastdfs-server/2.jpg上传

九、打开浏览器访问

在浏览器输入:192.168.0.249:8888/group1/M00/00/00/wKgA-WL7LI-AZ5WeABjKOnS-NU507.jpg
在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

睡前来杯海飞丝

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值