The new version of the installation tutorial refer to this article: blog.csdn.net/qq_32599479…

Step 1: Prepare the materials

Step 2: Install FastDFscommon

  • 2-1: Dependent environment required for installationyum -y install libevent
  • 2-2: Decompress the FastDFscommon packageThe tar - ZXVF libfastcommon - 1.0.7. Tar. Gz
  • 2-3: Go to the newly unzipped Fastdfscommon folder, find the make.sh file and use it for editing

    ./make.sh

If compilation fails, the solution is as follows:

yum install gcc-c++
yum install pcre pcre-devel
yum install zlib zlib-devel
yum install openssl openssl-devel
Copy the code
  • 2-4: Install the fastDFscommon file you just compiled./make.sh install
  • 2-5: The installation directory /usr/lib64 contains many files. You can run the following command to view all files in the directoryll libfast*
  • 2-6: Since lib64 is a 64-bit environment, we need to move it to the file

    Record the/usr/lib,cp libfastcommon.so /usr/lib

Step 3 install the Tracker service

  • 3-1: Find the FastdfS-5.05.tar. gz zip file and unzip it,Tar - ZXVF fastdfs 5.05. Tar. Gz
  • 3-2: Go to the newly unzipped Fastdfs-5.05.. folder and find the make.sh file to use for editing./make.sh
  • 3-3: Install the fastDFscommon file you just compiled./make.sh install
  • 3-4: After the installation,fastdfs adds files prefixed with FDFS to the /usr/bin/directoryll fdfs*

  • 3-5: In addition, fastdfs will also add related configurations to the /etc/fdfs/directory and go to this directorycd /etc/fdfs/Then view the files related to this directoryll

  • 3-6: Then go to the decompressed fastdfs-5.05 folder, which will contain the conf folder directory, and then enter this directory, as shown in the figure:

  • 3-7: copy all the above files to /etc/fdfs/directorycp * /etc/fdfs/, go to /etc/fdfs/and check the contents of this directoryll:

  • 3-8: Modify the tracker.conf filevim tracker.confFind the base_path key string (this path is also the log hold path, this is optional)base_path=/fastdfs/tracker
  • 3-9: create the path filled in on the upper surface, (the upper surface is

    /fastdfs/tracker) mkdir /fastdfs/tracker -p
  • 3-10: Separate storage, client and TMP in the root directory/create for the followingmkdir /fastdfs/storage -p.mkdir /fastdfs/client -p.mkdir /fastdfs/tmp -pEnter thecd /fastdfsthenllView the directory structure:

  • 3-11: (Can be entered firstcd /usr/binGo back to the car and check it outll fdfs*) Start the tracker service/usr/bin/fdfs_trackerd /etc/fdfs/tracker.confPress go back (restart command/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart)

Step 4: Install the storage service

  • Fastdfs /fastdfs/client/storage/tracke /fastdfs/client/storage/tracke
  • 4-2: Go to the /etc/fdfs directorycd /etc/fdfs/Then modify the storage.conf filevim storage.conf, find the base_path keyword and modify the path (where the logs are saved)

  • 4-3: find the group name keyword WDZL

  • 4-4: Look again for store_path0 (file store path)

  • 4-5: Associate the configuration with tracker, save and exit after the configuration:wq



    This should be the address of your own tracker.
  • 4-6: Starts the storage service and switches the directory to /usr/bin/./fdfs_storaged /etc/fdfs/storage.confCommand start service (./fdfs_storaged /etc/fdfs/storage.conf restart) restart.

  • 4-7: You can check whether the service is startedps aux | grep storage

Step 5: Configure the client and upload the test picture

5-1: Go to the /etc/fdfs/directory and modify the client.conf filevim client.confFind the base_path keyword (the directory where the logs are stored) and the address of the configuration tracker server

  • 5-2: directory to /usr/bin directory, a client_test file will open

    /usr/bin/fdfs_test /etc/fdfs/client.conf upload /home/testPic.jpg

    Ps: /home/1.jpg is where you want to upload the test image



    group_name =wdzl remote_filenameGroup_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name = group_name / fastdfs/storage/data / 00/00 / directory

Step 6: Fastdfs and Nginx configuration

  • 6-1: Find the fastdfs-nginx-module.tar.gz zip file and decompress ittar -zxvf fastdfs-nginx-module.tar.gz
  • 6-2: Go to the SRC directory of the decompressed file and modify the config filevim config, replace the following code, or remove the word local.



    ngx_addon_name=ngx_http_fastdfs_module

HTTP_MODULES=”$HTTP_MODULES ngx_http_fastdfs_module”

NGX_ADDON_SRCS=”$NGX_ADDON_SRCS

$ngx_addon_dir/ngx_http_fastdfs_module.c”

CORE_INCS=”$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/”

CORE_LIBS=”$CORE_LIBS -L/usr/lib -lfastcommon -lfdfsclient”

CFLAGS=”$CFLAGS

D_FILE_OFFSET_BITS=64

DFDFS_OUTPUT_CHUNK_SIZE = “256 * 1024”

DFDFS_MOD_CONF_FILENAME = “”/etc/FDFS/mod_fastdfs. Conf.” “” “

The path on ps must be the same as the previous path. If the preceding configuration is used, you can paste the path

Step 7: Install and configure nginx

  • 7-1: Libraries required to install nginx (no need to install them if you have installed them before)

  • 7-2: Find the previously uploaded nginx zip packageThe tar - ZXVF nginx - 1.12.0. Tar. Gz
  • 7-3: Decompress the fastdfs-nginx-module SRC file and go to the root directory (/home/nginx-1.12.0), copy and paste the following code, change the “-add-module” to the SRC file path, and press Enter



  • 7-4: Compile and install nginx. Enter the compile command in the root directory, for example, /home/tar/nginx-1.15.0make, and then installmake install
  • 7-5: After the installation is complete, the /usr/local/ directory contains an additional nginx file directory

  • 7-6: Go to the SRC directory in the fastdfs-nginx-module folder and copy mod_fastdfs.conf to /etc/fdfscp mod_fastdfs.conf /etc/fdfs

  • 7-7: Go to /etc/fdfs and modify the mod_fastdfs.conf filevim mod_fastdfs.conf, modify the following figure:



    This should be the address of your own tracker



    Configure group_nam



    Set this parameter to true to determine whether to add an organization name



    Configure store_path0 as shown in the following figure:

  • Usr /local/nginx/conf ll

  • 7-9: Edit the nginx.conf configuration fileVim nginx.conf, add new server node, save last:wq ‘server_name 192.168.1.103 is the IP address of the server to be accessed

  • 7-10: Check nginx go to the sbin directory in the nginx installation directory (you can use./nginx -t before starting to check whether the configuration is correct)

Problem 1: If the following problem occurs:



Go to the unzipped directory of nginx, delete the Makefile and re-enter the unzipped directory of nginx, for example:CD/home/tar/nginx - 1.15.2Press Enter to recompile the following code:



Press Enter, then go to the unzipped root directory to compile and install nginx, and enter the commandmake && make installPress Enter. Go to the sbin directory in the nginx installation directory again and enter the command./nginx -t, the results are as follows:



Problem 2: Lack of directory structure:



  • 7-11: Start nginx./nginx

Step 8 Check uploaded fSATDFS images

  • 8-1: Disable the firewall

  • 8-2: Open the browser and enter the picture address if the following screen appears



    Configure the mod_fastdfs.conf file againvim mod_fastdfs.confGo to mod_fastdfs (/etc/ FDFS)llEdit mod_fastdfs.conf to find the store_path0 keyword, point it to the path of your fastdfs storage directory, as shown, and save and exit:wq



    To restart the track (cd /usr/bin # fdfs_trackerd /etc/fdfs/tracker.conf )

    Restart the storage (cd/usr/bin # fdfs_storaged /etc/fdfs/storage.conf) server

    Finally restart the NINGx server (cd /usr/local/nginx/sbin)./nginx -s reload ,

    If no, there is no need to restart track and storage services. Then enter the following address in the browser:Image name http://192.168.1.103/wdzl/M00/00/00/



    Set up fastDFS distributed file storage successfully according to the above process!