Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
339 changes: 339 additions & 0 deletions docs/common/radxa-os/remote-login/_vnc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,339 @@
import { Image } from "@site/src/utils/docs";

## 使用说明

VNC 远程登录需要满足同一局域网和带有图形界面的系统。且双方设备需要开启 VNC 服务。

## 控制端(PC)

### 下载 VNC Viewer

我们需要在远程设备上安装 VNC Viewer 软件控制主板。

访问 [RealVNC](https://www.realvnc.com/en/connect/download/viewer) 官网下载 VNC Viewer 安装包。

① : 选择远程设备的系统平台

② : 下载 VNC Viewer 安装包

<div style={{ textAlign: "center" }}>
<img
src="/img/common/radxa-os/system-config/vnc-download.webp"
style={{ width: "100%", maxWidth: "1200px" }}
/>
</div>

### 安装 VNC Viewer

<Tabs queryString="install-vnc">

<TabItem value="Windows">

下载 windows 版本的 `*.exe` 安装包后。

- 运行安装包

以管理员身份运行 `VNC-Viewer-xxx.exe` 安装程序。

<div style={{ textAlign: "center" }}>
<img
src="/img/common/radxa-os/system-config/vnc-windows-install-01.webp"
style={{ width: "100%", maxWidth: "600px" }}
/>
</div>
- 软件语言

选择 `English` 语言,点击 `OK` 进入下一步。

<div style={{ textAlign: "center" }}>
<img
src="/img/common/radxa-os/system-config/vnc-windows-install-02.webp"
style={{ width: "100%", maxWidth: "300px" }}
/>
</div>

- 进入安装

点击 `Next` 进入安装程序。

<div style={{ textAlign: "center" }}>
<img
src="/img/common/radxa-os/system-config/vnc-windows-install-03.webp"
style={{ width: "100%", maxWidth: "600px" }}
/>
</div>

- 同意协议

勾选 `I accept the terms in the License Agreement` 选项,点击 `Next` 进入下一步。

<div style={{ textAlign: "center" }}>
<img
src="/img/common/radxa-os/system-config/vnc-windows-install-04.webp"
style={{ width: "100%", maxWidth: "600px" }}
/>
</div>

- 安装路径

建议选择软件默认安装路径,点击 `Next` 进入下一步。

<div style={{ textAlign: "center" }}>
<img
src="/img/common/radxa-os/system-config/vnc-windows-install-05.webp"
style={{ width: "100%", maxWidth: "600px" }}
/>
</div>

- 正式安装

点击 `Install` 开始正式安装。

<div style={{ textAlign: "center" }}>
<img
src="/img/common/radxa-os/system-config/vnc-windows-install-06.webp"
style={{ width: "100%", maxWidth: "600px" }}
/>
</div>

- 完成安装

点击 `Finish` 完成安装。

<div style={{ textAlign: "center" }}>
<img
src="/img/common/radxa-os/system-config/vnc-windows-install-07.webp"
style={{ width: "100%", maxWidth: "600px" }}
/>
</div>

</TabItem>

<TabItem value="Linux">

下载 Linux 版本的 `*.deb` 安装包后,在终端命令行运行以下命令安装 VNC Viewer:

<NewCodeBlock tip="Linux$" type="host">

```
sudo dpkg -i VNC-Viewer-xxx.deb
```

</NewCodeBlock>

</TabItem>

</Tabs>

### 运行 VNC Viewer

安装完成后,打开 VNC Viewer 软件: 您可以选择不登录账号使用 VNC Viewer 软件。

<div style={{ textAlign: "center" }}>
<img
src="/img/common/radxa-os/system-config/vnc-windows-use-01.webp"
style={{ width: "100%", maxWidth: "600px" }}
/>
</div>

<div style={{ textAlign: "center" }}>
VNC Viewer 界面
<img
src="/img/common/radxa-os/system-config/vnc-windows-use-02.webp"
style={{ width: "100%", maxWidth: "600px" }}
/>
</div>

## 被控端(主板)

### 安装 VNC 服务器

在主板的终端命令行运行以下命令安装 VNC 服务器:

<NewCodeBlock tip={`radxa@${props?.board ?? 'device'}$`} type="device">

```
sudo apt update
sudo apt install -y tigervnc-standalone-server tigervnc-tools dbus-x11 tigervnc-common
```

</NewCodeBlock>

### 设置 VNC 远程密码

在主板的终端命令行运行以下命令设置 VNC 远程密码:

<NewCodeBlock tip={`radxa@${props?.board ?? 'device'}$`} type="device">

```
vncpasswd
```

</NewCodeBlock>

:::tip
输入密码和确认密码不会显示在屏幕上,系统提示是否创建一个只读密码,选择 `n`(否)。
:::

完成密码设置后,系统会提示类似信息:

```
Password:
Verify:
Would you like to enter a view-only password (y/n)? n
A view-only password is not used
```

### 配置 VNC 启动文件

在主板编辑 `~/.vnc/xstartup` 文件:

<NewCodeBlock tip={`radxa@${props?.board ?? 'device'}$`} type="device">

```
sudo vi ~/.vnc/xstartup
Comment thread
Milir-Radxa marked this conversation as resolved.
Resolved
Comment thread
Milir-Radxa marked this conversation as resolved.
Resolved
```

</NewCodeBlock>

修改 `~/.vnc/xstartup` 文件内容为:

<Tabs queryString="desktop">

<TabItem value="x11" default={props.desktop === "x11"} attributes={{className: props.desktop === "gnome" && "tab_none"}}>

```
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
export XDG_SESSION_TYPE=x11
export DESKTOP_SESSION=plasma
exec startplasma-x11
```

</TabItem>

<TabItem value="gnome" default={props.desktop === "gnome"} attributes={{className: props.desktop === "x11" && "tab_none"}}>

```
#!/bin/sh

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR

if command -v dbus-launch >/dev/null 2>&1; then
eval "$(dbus-launch --sh-syntax --exit-with-session)"
fi

export XDG_SESSION_TYPE=x11
export DESKTOP_SESSION=ubuntu

exec gnome-session
```

</TabItem>

</Tabs>

编辑 `~/.vnc/xstartup` 文件后,需要赋予该文件可执行权限:

<NewCodeBlock tip={`radxa@${props?.board ?? 'device'}$`} type="device">

```
sudo chmod +x ~/.vnc/xstartup
Comment thread
Milir-Radxa marked this conversation as resolved.
Resolved
```

</NewCodeBlock>

### 启动 VNC 服务器

在主板的终端命令行运行以下命令启动 VNC 服务器:使用 `-localhost no` 参数可以允许远程访问。

<NewCodeBlock tip={`radxa@${props?.board ?? 'device'}$`} type="device">

```
vncserver -localhost no
```

</NewCodeBlock>

启动成功后,终端会输出类似信息,提示 VNC 服务器的端口号。

```
New Xtigervnc server \*\*\*:1 (radxa)' on port 5901 for display :1.
Use xtigervncviewer -SecurityTypes VncAuth -passwd /tmp/tigervnc.VQ4DfI/passwd :1 to connect to the VNC server.
```

### 查看 VNC 服务器状态

在主板的终端命令行运行以下命令查看 VNC 服务器状态:

<NewCodeBlock tip={`radxa@${props?.board ?? 'device'}$`} type="device">

```
vncserver -list
```

</NewCodeBlock>

终端会输出类似信息:

```
TigerVNC server sessions:

X DISPLAY # RFB PORT # RFB UNIX PATH PROCESS ID # SERVER
1 5901 3283 Xtigervnc
```

### 关闭 VNC 服务器

在主板的终端命令行运行以下命令可以关闭 VNC 服务器:其中命令中的 `:1` 代表 VNC 服务器的显示编号。

<NewCodeBlock tip={`radxa@${props?.board ?? 'device'}$`} type="device">

```
vncserver -kill :1
```

</NewCodeBlock>

关闭 VNC 服务器后,VNC Viewer 软件会自动断开连接。

## VNC 远程登录

在另一台设备上打开 VNC Viewer 软件,根据主板的 IP 地址和端口号进行 VNC 连接。

① : 填写主板的 IP 地址和端口号

② : 点击 `Connect to address ···` 连接主板

<div style={{ textAlign: "center" }}>
<img
src="/img/common/radxa-os/system-config/vnc-connect-01.webp"
style={{ width: "100%", maxWidth: "1200px" }}
/>
</div>

① : 输入 VNC 远程设置的密码

② : 勾选 `Remember password` 选项可以保存密码,方便下次登录

③ : 点击 `OK` 进行连接

<div style={{ textAlign: "center" }}>
<img
src="/img/common/radxa-os/system-config/vnc-connect-02.webp"
style={{ width: "100%", maxWidth: "1200px" }}
/>
</div>
<Image
src="/img/common/radxa-os/system-config/vnc-#desktop#-succ.webp"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The image source contains a placeholder #desktop# that won't be properly replaced. Consider using template literals or string interpolation:

Suggested change
src="/img/common/radxa-os/system-config/vnc-#desktop#-succ.webp"
src={`/img/common/radxa-os/system-config/vnc-${props.desktop}-succ.webp`}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以正常显示

desktop={props.desktop}
fallback={props.desktop}
width="1200"
/>

:::tip VNC 黑屏
若 VNC 远程登录黑屏,可以检查系统的自动登录选项是否开启,若开启,需要关闭自动登录选项。
:::
15 changes: 15 additions & 0 deletions docs/dragon/q6a/system-config/vnc-login.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
sidebar_position: 2
---

import VNC_REMOTE from '../../../common/radxa-os/remote-login/\_vnc.mdx';

# VNC 远程登录

:::tip 教程参考

本教程部分内容参考社区用户 YeWenXuan 的整理与贡献,特此致谢。

:::

<VNC_REMOTE desktop="gnome" board="dragon-q6a" />
Loading