2018-11-27 13:36:54 +08:00
|
|
|
|
# Fedora29 开启 VNC 远程桌面服务
|
|
|
|
|
|
|
|
|
|
VNC 远程 Gnome 环境没有成功,远程 MATE 桌面环境配置倒是非常简单,其他如 Cinnamon 环境类似。
|
|
|
|
|
|
|
|
|
|
## 安装
|
|
|
|
|
|
2021-06-15 16:36:39 +08:00
|
|
|
|
```bash
|
|
|
|
|
sudo dnf grouplist
|
|
|
|
|
sudo dnf groupinstall "MATE 桌面环境"
|
|
|
|
|
sudo dnf install tigervnc tigervnc-server
|
|
|
|
|
```
|
2018-11-27 13:36:54 +08:00
|
|
|
|
|
|
|
|
|
## 配置
|
|
|
|
|
|
2021-06-15 16:36:39 +08:00
|
|
|
|
```bash
|
|
|
|
|
vncserver :1
|
|
|
|
|
vncserver -kill :1
|
|
|
|
|
```
|
2018-11-27 13:36:54 +08:00
|
|
|
|
|
|
|
|
|
之后在 ~/.vnc 目录下自动产生 xstartup 文件,修改该文件的最后一行如下
|
|
|
|
|
|
2021-06-15 16:36:39 +08:00
|
|
|
|
```bash
|
|
|
|
|
#exec /etc/X11/xinit/xinitrc
|
|
|
|
|
exec /usr/bin/mate-session
|
|
|
|
|
#exec /usr/bin/cinnamon-session
|
|
|
|
|
```
|
2018-11-27 13:36:54 +08:00
|
|
|
|
|
|
|
|
|
## 防火墙
|
|
|
|
|
|
|
|
|
|
设置防火墙:
|
|
|
|
|
|
2021-06-15 16:36:39 +08:00
|
|
|
|
```bash
|
|
|
|
|
firewall-cmd --add-service=vnc-server --permanent
|
|
|
|
|
firewall-cmd --reload
|
|
|
|
|
```
|
2018-11-27 13:36:54 +08:00
|
|
|
|
|
|
|
|
|
或临时关闭防火墙:
|
|
|
|
|
|
2021-06-15 16:36:39 +08:00
|
|
|
|
```bash
|
|
|
|
|
systemctl stop firewalld.service
|
|
|
|
|
```
|
2018-11-27 13:36:54 +08:00
|
|
|
|
|
|
|
|
|
## 使用
|
|
|
|
|
|
2021-06-15 16:36:39 +08:00
|
|
|
|
```bash
|
|
|
|
|
vncserver :1 -geometry 1920x1080 -depth 24
|
|
|
|
|
```
|
2018-11-27 13:36:54 +08:00
|
|
|
|
|
|
|
|
|
之后使用 MobaXterm 或 VNC Viewer 连接到 IP:5901 即可。
|
|
|
|
|
|
|
|
|
|
如果 vncserver :2 则对应端口为 5902,以此类推。
|