Skip to content

Commit

Permalink
update NanoKVM zh document
Browse files Browse the repository at this point in the history
  • Loading branch information
wj-xiao committed Aug 13, 2024
1 parent 2189a6e commit 201cf8d
Show file tree
Hide file tree
Showing 28 changed files with 403 additions and 49 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/hardware/assets/NanoKVM/tailscale/login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/hardware/assets/NanoKVM/updating/login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/hardware/assets/NanoKVM/updating/ssh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/hardware/assets/NanoKVM/updating/update.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 0 additions & 29 deletions docs/hardware/zh/kvm/NanoKVM/4_firmware.md

This file was deleted.

38 changes: 38 additions & 0 deletions docs/hardware/zh/kvm/NanoKVM/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: 配置文件
keywords: NanoKVM, Remote desktop, Lichee, PiKVM, RISCV, tool
update:
- date: 2024-8-13
version: v0.1
author: xwj
content:
- Release docs
---


配置文件的路径为 `/etc/kvm/server.yaml`

默认的配置文件内容:

```yaml
protocol: http
port:
http: 80
https: 443
cert:
crt: server.crt
key: server.key
```
- protocol:网络协议,`http` 或 `https`
- port:服务运行的端口
- 当 protocol 为 http 时,服务会使用 port.http 端口
- 当 protocol 为 https 时,服务会使用 port.https 端口
- 当 protocol 为 https 时,在浏览器中访问时需要加上 `https://` 前缀 (例如:`https://192.168.1.210`)
- 如果你修改了端口,在浏览器中访问时请加上该端口。例如修改 port.http 为 8080,则在浏览器中的访问地址为 `192.168.1.210:8080`
- 请勿将端口设置为 0。服务检测到端口为 0 时,会使用默认配置覆盖当前配置文件
- cert:服务证书。如果 protocol 设置为 https,则需要配置该参数
- crt:证书文件的路径
- key:私钥文件的路径

注意,开启 https 后会增加 cpu 占用,可能会导致画面卡顿。
File renamed without changes.
File renamed without changes.
123 changes: 123 additions & 0 deletions docs/hardware/zh/kvm/NanoKVM/network/frp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
---
title: frp
keywords: NanoKVM, Remote desktop, Lichee, PiKVM, RISCV, tool
update:
- date: 2024-8-13
version: v0.1
author: xwj
content:
- Release docs
---

想要使用 frp,你需要自己编写配置文件,可以参考 [frp 文档](https://gofrp.org)

这里给出一个示例,实现通过 frp [访问内网的 web 服务](https://gofrp.org/zh-cn/docs/examples/vhost-http/)

注意:v1.0.0 版本的镜像不支持 frp。如果你的 NanoKVM 镜像版本是 v1.0.0,请先更新镜像。

## 启动 frps 服务

首先你需要一台带有公网 IP 的服务器,然后在该服务上启动 frps 服务。
这里我们假设该服务器 IP 地址为 `20.190.1.1`。你可以将这个 IP 替换为你自己的公网 IP。

1. 下载 [frp](https://github.com/fatedier/frp/releases/download/v0.59.0/frp_0.59.0_linux_riscv64.tar.gzf) 并解压,解压完成后进入该文件夹:

```bash
wget https://github.com/fatedier/frp/releases/download/v0.59.0/frp_0.59.0_linux_riscv64.tar.gz
tar -xzvf frp_0.59.0_linux_amd64.tar.gz
cd frp_0.59.0_linux_amd64
```

1. 创建配置文件 `frps.yaml`

```yaml
bindPort: 7000
vhostHTTPPort: 8080
```

1. 运行 frps 服务:

```bash
./frps -c frps.yaml
```

## 启动 frpc 服务

1. 通过 SSH 登录到 NanoKVM;
1. 执行 `frpc -v` 查看版本号,如果没有输出,则需要手动安装 frpc;
- 下载 [frp](https://github.com/fatedier/frp/releases/download/v0.59.0/frp_0.59.0_linux_riscv64.tar.gzf) 并解压;
- 将 `frpc` 文件移动到 `/usr/bin/` 目录

1. 创建配置文件 `/etc/kvm/frpc.yaml`

```yaml
serverAddr: 20.190.1.1 # 你的公网 IP
serverPort: 7000
proxies:
- name: nanokvm
type: http
localPort: 80
customDomains:
- 20.190.1.1
```

1. 启动 frpc 服务:

```bash
frpc -c /etc/kvm/frpc.yaml
```

frps 和 frpc 服务都启动后,在浏览器中输入 `20.190.1.1:8080`,就可以在公网中访问到 NanoKVM 了。

## 配置域名

如果你想给 NanoKVM 配置一个域名,可以修改 `frpc.yaml` 文件:

```yaml
serverAddr: 20.190.1.1 # 你的公网 IP
serverPort: 7000
proxies:
- name: nanokvm
type: http
localPort: 80
customDomains:
- www.yourdomain.com # 你的域名
```

然后将域名 [`www.yourdomain.com`](http://www.yourdomain.com) 解析到 `20.190.1.1`

使用浏览器打开 [`http://www.yourdomain.com:8080`](http://www.yourdomain.com:8080/) 即可访问到 `NanoKVM`

## 配置 HTTPS

可参考 frp 文档:[为本地 HTTP 服务启用 HTTPS](https://gofrp.org/zh-cn/docs/examples/https2http/)。

1. 配置 `frps.yaml` 文件:

```yaml
bindPort: 7000
vhostHTTPSPort: 443
```

1. 配置 `frpc.yaml` 文件

```yaml
serverAddr: 20.190.1.1 # 你的公网 IP
serverPort: 7000
proxies:
- name: nanokvm
type: https
customDomains:
- yourdomain.com # 你的域名
plugin:
type: https2http
localAddr: 127.0.0.1:80
crtPath: ./server.crt # 证书路径
keyPath: ./server.key # 私钥路径
hostHeaderRewrite: 127.0.0.1
requestHeaders:
set:
x-from-where: frp
```

1. 分别启动 frps 和 frpc 服务,然后在浏览器中访问 [`https://yourdomain.com`](https://yourdomain.com) 即可
39 changes: 39 additions & 0 deletions docs/hardware/zh/kvm/NanoKVM/network/static_ip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: 静态 IP
keywords: NanoKVM, Remote desktop, Lichee, PiKVM, RISCV, tool
update:
- date: 2024-8-13
version: v0.1
author: xwj
content:
- Release docs
---

NanoKVM 默认通过 DHCP 获取 IP,这意味着 NanoKVM 的 IP 可能会发生变化。

如果你希望始终使用同一个 IP 来访问 NanoKVM,可以给 NanoKVM 设置一个静态 IP。

## 设置静态 IP

在 NanoKVM 中创建文件 `/boot/eth.nodhcp` ,然后按照以下规则进行编辑:

- 一行就是一个自定义 IP,格式为 `addr/netid gw[optional]`
- 可以分多行来预设多个静态 IP。

```bash
# 示例
192.168.0.101/24 192.168.0.1 # addr/netid gw
192.168.3.116/22 # addr/netid
```

编辑并保存该文件后,执行 `/etc/init.d/S30eth restart` 命令使配置文件生效。

**注意**,如果所有预设的静态 IP 地址都被 arp 检测到已占用,则静态 IP 会设置失败。
此时会触发 DHCP 来获取 IP 地址。如果仍然获取失败,则会将 IP 强制设置成 `192.168.90.1/24`

这是为了保证 NanoKVM 总有一个可用的 IP 地址,以便能通过网络来操作 NanoKVM。
如果 NanoKVM 没有分配到可用的 IP 地址,则需要手动修改 TF 卡中的文件,或者重新烧录镜像才能正常使用。

## 取消静态 IP

删除 `/boot/eth.nodhcp` 文件,即可取消静态 IP。NanoKVM 会重新通过 DHCP 来获取 IP。
54 changes: 54 additions & 0 deletions docs/hardware/zh/kvm/NanoKVM/network/tailscale.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: Tailscale
keywords: NanoKVM, Remote desktop, Lichee, PiKVM, RISCV, tool
update:
- date: 2024-8-13
version: v0.1
author: xwj
content:
- Release docs
---


> **推荐将 NanoKVM 与 Tailscale 配合使用,来实现公网访问远程主机的目的。**
*注意:v1.0.0 版本的镜像不支持 Tailscale。如果你的 NanoKVM 镜像版本是 v1.0.0,请先[更新镜像](https://wiki.sipeed.com/nanokvm/hardware/zh/kvm/NanoKVM/start/flashing.html)*

目前 NanoKVM 已经内置了 Tailscale,只需要简单的操作即可开始使用。
有两种配置 Tailscale 的方式:在浏览器中配置和在终端中配置。
推荐在浏览器中进行配置。如果你需要更多的自定义功能,也可以在终端中进行配置。

## 在浏览器中配置

1. 在浏览器中输入 NanoKVM 的 IP 并访问;
1. 点击设置 - Tailscale:

![ipconfig](../../../../assets/NanoKVM/tailscale/setting.png)

1. 如果提示 Tailscale 未安装,请点击安装,并等待安装完成。如果显示已安装,则进行下一步:

![ipconfig](../../../../assets/NanoKVM/tailscale/install.png)

1. 点击登录,等待 Tailscale 启动并生成登录链接(该操作只需要执行一次,Tailscale 会开机自启):

![ipconfig](../../../../assets/NanoKVM/tailscale/login.png)

1. 登录链接生成后,浏览器会自动打开该链接。如果未自动跳转,请手动访问生成的链接。然后登录 Tailscale 账号,并点击 `Connect` 将 NanoKVM 加入到你的账号。

![ipconfig](../../../../assets/NanoKVM/tailscale/connect.png)

1. 现在可以在你的 Tailscale 账号下看到 NanoKVM 了。在公网环境中,运行 Tailscale,然后在浏览器中访问 `100.79.236.88 (替换为你的 Tailscale IP)`即可:

![ipconfig](../../../../assets/NanoKVM/tailscale/machines.png)

## 在终端中配置

1. 通过 SSH 登录到 NanoKVM;
2. 执行 `tailscale version` 检查 tailscale 是否已经安装。如果未安装,则手动进行安装:
- 下载 [Tailscale](https://pkgs.tailscale.com/stable/tailscale_latest_riscv64.tgz) 并解压;
-`tailscale` 文件移动到 `/usr/bin/` 目录;
-`tailscaled` 文件移动到 `/usr/sbin/` 目录。
3. 执行 `/etc/init.d/S98tailscaled restart` ,启动 tailscale 服务;
4. 执行 `tailscale login` ,等待登录链接生成,然后在浏览器中访问生成的链接;
5. 在浏览器中点击 `Connect` ,将 NanoKVM 加入到你的 Tailscale 账户;
6. 操作完成!现在就可以通过 Tailscale 访问 NanoKVM 了。
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 快速开始
title: 总览
keywords: NanoKVM, Remote desktop, Lichee, PiKVM, RISCV, tool
update:
- date: 2024-7-4
Expand All @@ -15,8 +15,6 @@ update:

Full版包含 NanoKVM(带外壳,带卡)、KVM-B板、USB A to C 线 *2、杜邦线。



Lite版包含 NanoKVM(不带外壳和TF卡) 、散热片。

## 接口介绍
Expand Down
44 changes: 44 additions & 0 deletions docs/hardware/zh/kvm/NanoKVM/start/flashing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: 烧录系统
keywords: NanoKVM, Remote desktop, Lichee, PiKVM, RISCV, tool
update:
- date: 2024-8-13
version: v0.1
author: xwj
content:
- Release docs
---

*NanoKVM Full 版本出厂时已经烧录了镜像,可以选择跳过该步骤。*

1. 准备 SD 卡:

- Full 版本自带一张 32G 的 SD 卡,需要拆开外壳将其取出;
- Lite 版本需要自己准备一张 8G 以上的 SD 卡。

1. 前往 [Github](https://github.com/sipeed/NanoKVM/releases) 下载最新版本镜像。

1. 安装烧录软件,推荐使用 [Etcher](https://etcher.balena.io)

1. 运行 Etcher:
![run Ethcer](../../../../assets/NanoKVM/flashing/run_etcher.png)

1. 点击 `Flash from file`,选择镜像文件:

![select image](../../../../assets/NanoKVM/flashing/select_image.png)

1. 点击 `Select target`,选择 SD 卡:

![select target](../../../../assets/NanoKVM/flashing/select_target.png)

1. 点击 `Flash!`,开始烧录:

![select target](../../../../assets/NanoKVM/flashing/flashing.png)

1. 等待镜像烧录完成。

![select target](../../../../assets/NanoKVM/flashing/flashed.png)

恭喜!镜像烧录完成!

现在,你可以将 SD 卡装到 NanoKVM 上,然后进行下一步的操作了。
Loading

0 comments on commit 201cf8d

Please sign in to comment.