Skip to content

Commit

Permalink
update cn doc (#939)
Browse files Browse the repository at this point in the history
update cn doc for PR #925 

@Jinxiansen
  • Loading branch information
redsun committed Nov 23, 2023
1 parent 40a7eea commit 6ae2011
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 52 deletions.
51 changes: 12 additions & 39 deletions docs/deploy/digital-ocean.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,52 +71,25 @@ ssh vapor@your_server_ip

现在你已经创建了一个新的 Ubuntu 服务器并且通过非 root 身份登录到服务器,你可以安装 Swift。

### Swift 依赖项
### 使用 Swiftly CLI 工具自动安装(推荐)

安装 Swift 所需要的依赖项。
访问 [Swiflty 网站](https://swift-server.github.io/swiftly/)获取在 Linux 上安装 Swiftly 和 Swift 的说明。之后,安装 Swift 使用如下命令:

```sh
sudo apt-get update
sudo apt-get install binutils git gnupg2 libc6-dev libcurl4-openssl-dev
\ libedit2 libgcc-9-dev libpython3.8 libsqlite3-0 libstdc++-9-dev
\ libxml2-dev libz3-dev pkg-config tzdata unzip zlib1g-dev
```

### 下载 Swift Toolchain

本指南将安装 Swift 5.7.3。访问 [Swift Releases](https://swift.org/download/#releases) 页面获取最新版本的链接。复制 Ubuntu 22.04 的下载链接。

![Download Swift](../images/swift-download-ubuntu-copy-link.png)

下载并解压 Swift toolchain。
#### 基本用法

```sh
wget https://download.swift.org/swift-5.7.3-release/ubuntu2204/swift-5.7.3-RELEASE/swift-5.7.3-RELEASE-ubuntu22.04.tar.gz
tar xzf swift-5.7.3-RELEASE-ubuntu22.04.tar.gz
```
$ swiftly install latest

!!! note "注意"
Swift 的[使用下载指南](https://swift.org/download/#using-downloads)包含有关如何使用 PGP 签名验证下载的信息。
Fetching the latest stable Swift release...
Installing Swift 5.9.1
Downloaded 488.5 MiB of 488.5 MiB
Extracting toolchain...
Swift 5.9.1 installed successfully!

### 安装 Swift Toolchain
$ swift --version

将 Swift 移到易于访问的地方。本指南将 `/swift` 与子文件夹中的每个编译器版本一起使用。

```sh
sudo mkdir /swift
sudo mv swift-5.7.3-RELEASE-ubuntu22.04 /swift/5.7.3
```

将 Swift 添加到 `/usr/bin` 以便 `vapor``root` 用户可以执行。

```sh
sudo ln -s /swift/5.7.3/usr/bin/swift /usr/bin/swift
```

验证 Swift 是否正确安装。

```sh
swift --version
Swift version 5.9.1 (swift-5.9.1-RELEASE)
Target: x86_64-unknown-linux-gnu
```

## 使用 Vapor 工具箱安装 Vapor
Expand Down
39 changes: 26 additions & 13 deletions docs/install/linux.zh.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,39 @@

# 在 Linux 上面安装

你需要 Swift 5.6 或更高版本来使用 Vapor。可以通过 [Swift.org](https://swift.org/download/) 上面的工具链来安装。
你需要 Swift 5.7 或更高版本来使用 Vapor。你可以使用 Swift Server Workgroup 提供的 CLI 工具 [Swiftly](https://swift-server.github.io/swiftly/) 来安装(推荐),也可以通过 [Swift.org](https://swift.org/download/) 上面的工具链来安装。

## 支持的发行版和版本

Vapor 与 Swift 5.6 或者更高的版本对 Linux 的版本支持保持一致。

!!! note "注意"
下面列出的版本可能会随时过期。你可以到 [Swift Releases](https://swift.org/download/#releases) 官方网站去确认官方支持的操作系统。

|Distribution|Version|Swift Version|
|-|-|-|
|Ubuntu|20.04|>= 5.6|
|Fedora|>= 30|>= 5.6|
|CentOS|8|>= 5.6|
|Amazon Linux|2|>= 5.6|
Vapor 支持的发行版的版本与 Swift 5.7 或更新版本支持的 Linux 发行版的版本相同。请参阅[官方支持页面](https://www.swift.org/platform-support/)查找有关官方支持的操作系统的最新信息。

不受官方支持的 Linux 发行版也可以通过编译源代码来运行 Swift,但是 Vapor 不能保证其稳定性。可以在 [Swift repo](https://github.com/apple/swift#getting-started) 学习更多关于编译 Swift 的信息。

## 安装 Swift

### 使用 Swiftly CLI 工具自动安装(推荐)

访问 [Swifty 网站](https://swift-server.github.io/swiftly/)获取在Linux上安装 Swiftly 和 Swift 的说明。之后,使用以下命令安装 Swift:

#### 基本使用

```sh
$ swiftly install latest

Fetching the latest stable Swift release...
Installing Swift 5.9.1
Downloaded 488.5 MiB of 488.5 MiB
Extracting toolchain...
Swift 5.9.1 installed successfully!

$ swift --version

Swift version 5.9.1 (swift-5.9.1-RELEASE)
Target: x86_64-unknown-linux-gnu
```

### 使用 toolchain 手动安装

访问 Swift.org 的 [Using Downloads](https://swift.org/download/#using-downloads) 手册来学习如何在 Linux 安装 Swift。

### Fedora
Expand All @@ -31,7 +44,7 @@ Fedora 用户可以简单的通过下面的命令来安装 Swift:
sudo dnf install swift-lang
```

如果你正在使用 Fedora 30,你需要添加添加 EPEL 8 来获取 Swift 5.6 或更新的版本。
如果你正在使用 Fedora 35,你需要添加添加 EPEL 8 来获取 Swift 5.7 或更新的版本。


## Docker
Expand Down

0 comments on commit 6ae2011

Please sign in to comment.