• 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
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    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
    
    • 1
    • 2
    • 3
    • 4

    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 
    
    • 1
    • 2
    • 3
    • 4

    二、安装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
    
    • 1
    • 2

    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
    
    • 1
    • 2
    • 3
    • 4

    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
    
    • 1
    • 2
    • 3
    • 4

    三、配置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   
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37

    四、配置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 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48

    五、安装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) 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    六、配置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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24

    七、配置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 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    八、测试上传

    修改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上传
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48

    九、打开浏览器访问

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

  • 相关阅读:
    在linux下安装jenkins
    ubuntu20.04部署ntp服务器ntpd(ntpdate )
    共享股东模式:一种新型的连锁门店运营方式
    【挑战开发100个项目 | 1. C语言学生管理系统】
    2022年 - 年中总结
    R语言数据重塑
    从零开始利用MATLAB进行FPGA设计(七)用ADC采集信号教程2
    mindspore.scipy 入门使用指导
    apollo分布式配置优先级学习
    自动驾驶:轨迹预测综述
  • 原文地址:https://blog.csdn.net/u013317172/article/details/126349762