> For the complete documentation index, see [llms.txt](https://data-programs.gitbook.io/singularity/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://data-programs.gitbook.io/singularity/zh/installation/install-from-source.md).

# 从源代码构建

在继续安装 Singularity 之前，请确保您的系统已经安装了 [Go 1.20 或更高版本](https://golang.org/dl/)。

## 配置 Go

按照以下步骤使 Go 正常运行：

1. **下载并解压 Go 二进制文件**：

   ```bash
   wget -c https://golang.org/dl/go1.20.7.linux-amd64.tar.gz -O - \
       | sudo tar -xz -C /usr/local
   ```
2. **更新 PATH 变量**： 将 Go 的二进制文件和工作目录添加到您的 `PATH` 变量中：

   ```bash
   echo 'export PATH=$PATH:/usr/local/go/bin:$(/usr/local/go/bin/go env GOPATH)/bin' \
       >> ~/.bashrc && source ~/.bashrc
   ```

## 安装最新版本的 Singularity

安装最新稳定版的 Singularity：

```bash
go install github.com/data-preservation-programs/singularity@latest
```

## 尝试未发布的功能

如果您想要探索最新的未发布功能：

1. **克隆 Singularity 仓库**：

   ```bash
   git clone https://github.com/data-preservation-programs/singularity.git
   ```
2. **进入 Singularity 目录**：

   ```bash
   cd singularity
   ```
3. **构建并安装**：

   ```bash
   go build -o singularity .
   cp singularity $GOPATH/bin
   ```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://data-programs.gitbook.io/singularity/zh/installation/install-from-source.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
