openfang提供了几种途径安装openfang,下面分别介绍其安装方法
使用命令安装
官方提供的安装脚本如下:
curl -fsSL https://openfang.sh/install | sh通常情况下,我们可以使用官网提供的一键式脚本安装,但是通过一键式脚本安装的时候,经常会由于网络等原因问题,安装失败,出现如下的错误,我们可以尝试通过修改安装脚本或使用cargo来基于源码安装。
安装错误:
zhangzhijun@debian:~$ curl -fsSL https://openfang.sh/install | sh
openfang Detected: Linux x86_64 -> x86_64-unknown-linux-gnu
openfang Downloading from: https://github.com/RightNow-AI/openfang/releases/latest/download/openfang-x86_64-unknown-linux-gnu.tar.gz
curl: (56) Recv failure: 连接被对方重置
openfang error: Download failed (HTTP 000). Check https://github.com/RightNow-AI/openfang/releases通过修改安装脚本的方式安装:
1、进入github,下载最新的release包:https://github.com/RightNow-AI/openfang/releases
2、通过wget https://openfang.sh/install下载安装脚本
3、打开下载后的install脚本,修改如下地方:
1)修改url为第一步下载后的安装包的路径
# _url="https://github.com/${REPO}/releases/latest/download/openfang-${_target}.tar.gz"
_url="/data/workspace/openfang/openfang-aarch64-unknown-linux-gnu.tar.gz"2)修改_code代码,替换为cp命令
# _code=$(curl -fsSL -w "%{http_code}" "$_url" -o "${_tmpdir}/openfang.tar.gz") || true
# if [ "$_code" = "404" ]; then
# err "Release not found for ${_target}. Check https://github.com/${REPO}/releases"
# fi
cp "$_url" "${_tmpdir}/openfang.tar.gz"4、install增加执行权限,执行./install安装
5、出现OpenFang installed successfully!之后,执行source ~/.bashrc
到此通过修改install脚本安装openfang结束。
使用cargo通过源码安装:
方案1:
cargo install --git https://github.com/RightNow-AI/openfang.git openfang-cli方案2:
git clone https://github.com/RightNow-AI/openfang.git
cd openfang
cargo build --release -p openfang-cli说明:
1)使用源码安装前,必须先安装rust。安装方式参加rust相关文档。
2)若版本不是最新的,可通过增加--force 参数,获取最新代码安装。