# 安装

您可以通过环境变量设置 `$SWAN_PATH`，默认 `~/.swan`：

```
export SWAN_PATH="/data/.swan"
```

#### 选项1️⃣ **预构建包**: 参照 [release assets](https://github.com/filswan/go-swan-provider/releases)

**构建指南**

```
wget --no-check-certificate https://raw.githubusercontent.com/filswan/go-swan-provider/release-2.1.0-rc1/install.sh
chmod +x ./install.sh
./install.sh
```

**配置和运行**

* 编辑配置文件 **\~/.swan/provider/config.toml**, 参考 [此处](/swan-provider/shi-yong-zhi-nan/pei-zhi-bing-yun-xing.md)
* 在后台运行 `swan-provider`

```
ulimit -SHn 1048576
export SWAN_PATH="/data/.swan"
nohup swan-provider-2.1.0-rc1-linux-amd64 daemon >> swan-provider.log 2>&1 & 
```

#### 选项2️⃣ 从源代码构建

构建 `swan-provider` 需要安装以下依赖包:

```
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
```

```
sudo apt-get install -y nodejs
```

```
sudo apt install mesa-opencl-icd ocl-icd-opencl-dev gcc git bzr jq pkg-config curl clang build-essential hwloc libhwloc-dev wget -y && sudo apt upgrade -y
```

* Go(需要 **1.18.1+**)

```
wget -c https://golang.org/dl/go1.18.1.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
```

```
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc && source ~/.bashrc
```

* Rustup

```
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

**构建指南**

```
git clone https://github.com/filswan/go-swan-provider.git
cd go-swan-provider
git checkout release-2.1.0-rc1
./build_from_source.sh
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-cn.filswan.com/swan-provider/shi-yong-zhi-nan/an-zhuang.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
