Play to Linux host--fastdfs single node installation __linux

Source: Internet
Author: User

Configuring the Environment

CentOS7
vmware


fastdfs-master.zip
libfastcommonlibfastcommon-master.zip
Fastdfs-nginx-module-master.zip
nginx-1.8.1.tar.gz

Download Address: Https://github.com/happyfish100/

1. Installation system
If there is no access to the graphical interface, follow these inputs

1
2
q

2. Give Yushengyun user root privileges
Enter root account

Su
vi/etc/sudoers
adds a   row of
Yushengyun  all= (
All) to root all= (all) Exit Root Account Exit

3. Configure the Network

    Find the appropriate file
    sudo vi/etc/sysconfig/network-scripts/ifcfg-eno16777736
    changes the Onboot property to Yes to
    save exit
    Restart Network Services
    sudo service network restart

4. Install GCC and upgrade system modify firewall

sudo yum install make cmake gcc gcc-c++
sudo yum update

centOS7 The default firewall for firewall to change it to iptables 
    sudo Systemctl stop firewalld.service #停止firewall
    sudo systemctl disable firewalld.service #禁止firewall开机启动
    sudo Yum Install iptables-services #安装

5. Compile installation Libfastcommon, Fastdfs

(1), install Libfastcommon
    unzip libfastcommon-master.zip
    cd libfastcommon-master/make.sh
    ./make.sh Install
    install Fastdfs
    unzip fastdfs-master.zip 
    cd  fastdfs-master
    ./make.sh/make.sh. Install

appropriate files and directories
    when installed by default (1), service script in:
             /etc/init.d/fdfs_storaged
             /etc/init.d/fdfs_tracker
    (2), configuration file in (sample configuration file): 
             /etc/fdfs /client.conf.sample 
             /etc/fdfs/storage.conf.sample 
             /etc/fdfs/tracker.conf.sample
    (3), command tool in/usr/ Under the bin/directory:
             fdfs_appender_test
             fdfs_appender_test1
             fdfs_append_file
             fdfs_crc32
             fdfs_ Delete_file
             fdfs_download_file
             fdfs_file_info
             fdfs_monitor
             fdfs_storaged
             fdfs_test
             fdfs_test1
             fdfs_trackerd
             fdfs_upload_appender
             fdfs_upload_file
             stop.sh
             restart.sh

6. Configuration file

(1) Create the underlying folder Cd/home/yushengyun//Enter the user's home folder mkdir Fastdfs cd/fastdfs mkdir storage mkdir Tracker (2), copy three configuration files Cd/etc/fdfs sudo cp/etc/fdfs/tracker.conf.sample/etc/fdfs/tracker.conf sudo cp/etc/fdfs/stor 
    age.conf.sample/etc/fdfs/storage.conf sudo cp/etc/fdfs/client.conf.sample/etc/fdfs/client.conf (3), Configuration tracker.conf sudo vi/etc/fdfs/tracker.conf to convert Base_path to/home/yushengyun/fastdfs/tracker sudo vi/etc/sysconfig/ip Tables add row-A input-m State--state new-m tcp-p TCP--dport 22122-j Restart firewall sudo service ACCEPT Bles Restart startup Sudo/etc/init.d/fdfs_trackerd Start start will create data and logs in the directory to see if it starts Ps-ef | grep fdfs set boot up sudo vi/etc/rc.d/rc.local add # # Fastdfs Tracker/etc/init.d/fdfs _trackerd Start (4), configure storage.conf sudo vi/etc/fdfs/storage.conf to convert Base_path to/home/yushengyun/fastdfs/sto Rage will be one of the Base_patH0 changed to/home/yushengyun/fastdfs/storage tracker_server to 192.168.198.131:22122 sudo vi/etc/sysconfig/iptables Add row-A input-m State--state new-m tcp-p TCP--dport 23000-j Restart firewall sudo service ACCEPT r Estart start sudo/etc/init.d/fdfs_storaged start start up will create data and logs in the directory to see if it starts Ps-ef | grep fdfs set boot up sudo vi/etc/rc.d/rc.local add # # Fastdfs Storage/etc/init.d/fdfs _storaged Start (5), configure client.conf sudo vi/etc/fdfs/client.conf modify base_path for/fastdfs/tracker modify tra
 Cker_server for 192.168.192.131:22122

7. Test

In the home folder, create a new file a.txt, and type Hello

/usr/bin/fdfs_upload_file/etc/fdfs/client.conf/home/yushengyun/1.png

There were some problems during the upload.
after searching, reboot two services
    sudo/usr/bin/restart.sh/usr/bin/fdfs_storaged/etc/fdfs/storage.conf
    sudo/usr/bin/restart.sh/usr/bin/fdfs_trackerd/etc/fdfs/tracker.conf
Error disappears upload success
    get group1/m00/00/00/ Wkjgg1ccfv2acsmtaaa-isqt7o0177.png

files uploaded when you access a test through a browser

8.nginx and Fastdfs-nginx-module configuration issues

(1) Fastdfs-nginx-module will fastdfs-nginx-module-master.zip upload to/usr/local/src/cd/usr/local/src/decompression sudo Unzip fastdfs-nginx-module-master.zip View fastdfs-nginx-module Config profile modified to core_incs= "$CORE _incs/usr/include/f
        astdfs/usr/include/fastcommon/"sudo vi fastdfs-nginx-module-master/src/config (2) Download compile installation configuration Nginx download Nginx sudo wget http://nginx.org/download/nginx-1.8.1.tar.gz download nginx required dependent package sudo yum install gcc gcc-c++ make auto 
        Make autoconf libtool pcre* zlib OpenSSL openssl-devel decompression nginx sudo tar-zxvf nginx-1.8.1.tar.gz compile installation Nginx
        Cd/usr/local/src/nginx-1.8.1/sudo./configure--ADD-MODULE=/USR/LOCAL/SRC/FASTDFS-NGINX-MODULE/SRC sudo make &&sudo make install copy the configuration files from the Fastdfs-nginx-module source to the/etc/fdfs directory and modify sudo cp/usr/local/sr
            C/fastdfs-nginx-module-master/src/mod_fastdfs.conf/etc/fdfs/sudo vi/etc/fdfs/mod_fastdfs.conf Modify Configuration connect_timeout=Ten tracker_server=192.168.198.131:22122 Url_have_group_name=true Store_path0=/home/yus Hengyun/fastdfs/storage copy Fastdfs partial configuration file to/etc/fdfs cd/home/yushengyun/fastdfs-master/conf sudo cp htt p.conf mime.types/etc/fdfs//home/yushengyun/fastdfs/storage resume soft link sudo ln-s/home/yushengyun/fastdfs/stora
            GE/DATA/HOME/YUSHENGYUN/FASTDFS/STORAGE/DATA/M00 configuration nginx cd/usr/local/nginx/conf sudo vi nginx.conf
                Configure the following user root;

                Worker_processes 1;
                #error_log Logs/error.log;
                #error_log Logs/error.log Notice;

                #error_log Logs/error.log Info;


                #pid Logs/nginx.pid;
                Events {Worker_connections 1024;
                    } http {include mime.types;

              Default_type Application/octet-stream;      #log_format Main ' $remote _addr-$remote _user [$time _local] "$request" ' # ' $ Status $body _bytes_sent "$http _referer" "$http _user_agent" "$http _x_forwarded_fo

                    R "';

                    #access_log Logs/access.log Main;
                    Sendfile on;

                    #tcp_nopush on;
                    #keepalive_timeout 0;

                    Keepalive_timeout 65;
                    #gzip on;
                        server {Listen 8888;

                        server_name localhost;

                        #charset Koi8-r;

                        #access_log Logs/host.access.log Main;
                           Location ~/group ([0-9])/m00 {#alias home/yushengyun/fastdfs/storage/data;
                        Ngx_fastdfs_module;
} #error_page 404/404.html;
                        # REDIRECT Server error pages to the static page/50x.html #
                        Error_page 502 503 504/50x.html;
                        Location =/50x.html {root html;  Open nginx Port sudo vi/etc/sysconfig/iptables add-A input-m State--state new-m tcp-p
        TCP--dport 8888-j ACCEPT # service iptables restart reboot Firewall sudo service iptables restart boot
 Sudo/usr/local/nginx/sbin/nginx (restart Nginx command for sudo/usr/local/nginx/sbin/nginx-s Reload)

9. Test

    Access uploaded pictures through the browser
        http://192.168.198.131:8888/group1/M00/00/00/wKjGg1ccfv2ACsMtAAA-Isqt7o0177.png

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.