CentOS7.X安装FastDHT

FastDHT

  1. 先安装FastDFS
  2. 安装前的准备

    yum install \
    vim \
    git \
    gcc \
    gcc-c++ \
    wget \
    make \
    automake \
    autoconf \
    libtool \
    libdb \
    libdb-devel \
    libevent \
    libevent-devel \
    -y \
  3. 安装libfastcommon

    cd /root
    git clone https://github.com/happyfish100/libfastcommon.git
    cd libfastcommon/
    ./make.sh
    ./make.sh install
  4. 安装Berkley db-6.2.23

    cd /root
    wget http://download.oracle.com/berkeley-db/db-6.2.23.tar.gz
    tar -zxvf db-6.2.23.tar.gz
    cd db-6.2.23
    ./dist/configure --prefix=/usr/local/db
    make
    make install
  5. 安装FastDHT

    cd /root
    git clone https://github.com/happyfish100/fastdht.git
    cd fastdht
    #修改make.sh
    vim make.sh
    CFLAGS='-Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE'
    #改为:
    CFLAGS='-Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I/usr/local/db/include/ -L/usr/local/db/lib/'
    ESC
    :wq
    ./make.sh
    ./make.sh install
  6. 配置文件

    # 如没有/etc/fdht目录及目录下文件
    mkdir /etc/fdht
    mkdir /data/fdht
    
    cp /root/fastdht/conf/fdht_client.conf /etc/fdht
    cp /root/fastdht/conf/fdhtd.conf /etc/fdht
    cp /root/fastdht/conf/fdht_servers.conf /etc/fdht
  7. 配置fdht_client.conf

    vim /etc/fdht/fdht_client.conf
    
    #本选项关联 storaged.conf文件
    keep_alive=1
    base_path=/data/fdht
    #include /etc/fdht/fdht_servers.conf
    
    ESC
    :wq
  8. 配置fdht_servers.conf(11411)

    vim /etc/fdht/fdht_servers.conf
    
    group_count=2
    group0 = 192.168.1.201:11411
    group0 = 192.168.1.202:11411
    group1 = 192.168.1.203:11411
    group1 = 192.168.1.204:11411
    
    ESC
    :wq
  9. 配置fdhtd.conf

    vim /etc/fdht/fdhtd.conf
    
    bind_addr=192.168.1.101
    port=11411
    base_path=/data/fdht
    cache_size=64MB
    #include /etc/fdht/fdht_servers.conf
    
    ESC
    :wq
  10. 引入libdb.so

    ln -s /usr/local/db/lib/libdb-6.2.so /usr/lib/libdb-6.2.so
    ln -s /usr/local/db/lib/libdb-6.2.so /usr/lib64/libdb-6.2.so
  11. 开启11411端口

    yum install firewalld
    systemctl enable firewalld
    systemctl start firewalld
    
    firewall-cmd --zone=public --add-port=11411/tcp --permanent
    firewall-cmd --reload
  12. 启动FastDHT

    /usr/local/bin/fdhtd /etc/fdht/fdhtd.conf
  13. 开机启动

    vim /etc/rc.local
    
    /usr/local/bin/fdhtd /etc/fdht/fdhtd.conf
    
    ESC
    :wq
    
    chmod +x /etc/rc.local
  14. 领支付宝红包支持作者

    CentOS7.X安装FastDHT

上一篇:CentOS7.X通过firewalld管理端口


下一篇:无所不在的物联网设备 你我都需要正视所带来的安全问题