在OpenBSD环境下安装BFE

下文以OpenBSD 6.6及BFE 0.4.0版本为例,说明安装流程

环境说明

  • 设置OpenBSD 6.6软件源安装路径并安装相关软件包:

amd64

  1. # export PKG_PATH="https://mirrors.tuna.tsinghua.edu.cn/OpenBSD/6.6/packages/amd64/"
  2. # pkg_add wget go

i386

  1. # export PKG_PATH="https://mirrors.tuna.tsinghua.edu.cn/OpenBSD/6.6/packages/i386/"
  2. # pkg_add llvm wget go
  • 由于OpenBSD 6.6自带的make 无法编译BFE,因此需要安装gnu make

amd64

  1. # wget http://ftp.gnu.org/gnu/make/make-4.2.tar.bz2
  2. # tar -xvjf make-4.2.tar.bz2
  3. # cd make-4.2
  4. # ./configure
  5. # make -j8
  6. # make install

i386

  1. # cd /usr/bin
  2. # ln -s clang gcc
  3. #
  4. # wget http://ftp.gnu.org/gnu/make/make-4.2.tar.bz2
  5. # tar -xvjf make-4.2.tar.bz2
  6. # cd make-4.2
  7. # ./configure
  8. # make -j8
  9. # make install

编译安装BFE

  • 下载bfe 0.4.0 并编译安装

    1. # wget https://github.com/bfenetworks/bfe/archive/v0.4.0.tar.gz
    2. # tar -xvzf v0.4.0.tar.gz
    3. # cd bfe-0.4.0/
    4. # export GOPROXY=https://goproxy.io
    5. # /usr/local/bin/make -j8
    6. #
    7. # mkdir -p /usr/local/bfe/bin
    8. # cp bfe /usr/local/bfe/bin
    9. # cp -fr conf/ /usr/local/bfe
  • 修改配置文件

    1. # cd /usr/local/bfe/conf/mod_access/
    2. # vi mod_access.conf
    3. LogDir = ../log
    4. :wq ## 保存退出
  • 创建启动脚本及运行 ```bash

    mkdir /root/run_bfe

    cd /root/run_bfe

    vi run_bfe.sh

    !/usr/local/bin/bash

    cd /usr/local/bfe/bin ./bfe -c ../conf -l ../log & :wq ## 保存退出

chmod 755 run_bfe.sh

sh run_bfe.sh

ps |grep bfe

25625 p0 I 6:08.02 ./bfe -c ../conf -l ../log 79047 p0 R+/2 0:00.00 grep bfe ```