TigerVNC使用

一、背景

  1. 有些工作必须要GUI
  2. 真正可以把linux作为日常的桌面,看个pdf和挂个libera.chat就随意了

二、前提条件:

multi-user.service 字符界面下

注意阅读材料 /usr/share/doc/tigervnc/HOWTO.md

三、服务器端

1. 安装

1
dnf install -y tigervnc-server

2. 设置用户及其对应的window,注意VNC里面用户是与window绑定的

#nano /etc/tigervnc/vncserver.users

1
2
3
4
5
6
7
8
# TigerVNC User assignment
#
# This file assigns users to specific VNC display numbers.
# The syntax is <display>=<username>. E.g.:
#
# :2=andrew
# :3=lisa
:1=xxxx

3. 设置默认工作流,类似与xinit的配置

#nano /etc/tigervnc/vncserver-config-defaults

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Default settings for VNC servers started by the vncserver service
#
# Any settings given here will override the builtin defaults, but can
# also be overriden by ~/.config/tigervnc/config and vncserver-config-mandatory.
#
# See HOWTO.md and the following manpages for more details:
#     vncsession(8) Xvnc(1)
#
# Several common settings are shown below. Uncomment and modify to your
# liking.

# session=gnome
# securitytypes=vncauth,tlsvnc
# geometry=2000x1200
# localhost
# alwaysshared

# Default to GNOME session
# Note: change this only when you know what are you doing
#securitytypes=vncauth,tlsvnc
geometry=1920x1080
dpi=96
session=gnome-session &

这里用的传统配置,注意加后台运行标记,第一次没加,然后DISPLAY还设定到远程ip,结果是远程服务器启动的xwindow直接跳出到我的windows桌面上

localhost则限定本地连接,可能与ssh tunnel相关

4. 普通用户设置自己的vnc登录密码

1
$vncpasswd

5. 超级用户运行服务

1
   #systemctl  start vncserver@:1

6. 检查服务状态,看端口情况

1
2
   #systemctl  status vncserver@:1
   #netstats -lpn

7. 检查服务器端的端口是否打开

1
2
   #firewall-cmd --zone=public  --add-service=vnc-server   --permanent
   #firewall-cmd --reload

然后就可以用客户端测试vnc连接

四、客户端

1. 下载windows版本客户端

下载地址

发现mobaxterm的vnc连接图像有些色块,所以还是得原配的Tiger vncviewer

2. 测试连接

连接VNC

注意端口的写法是2个冒号

五、待查

1. 通过安全隧道

2. 普通用户自己设置vnc连接

参考

  1. 启RHEL7的VNC Server服务及防火墙配置的方法
  2. Windows使用TigerVNC连接Linux图形化桌面
  3. CentOS 7 下 VNC 安装并指定端口启动
  4. 在Linux下配置RealVNC和TigerVNC
Licensed under CC BY-NC-SA 4.0
不积跬步,无以至千里;不积小流,无以成江海
使用 Hugo 构建
主题 StackJimmy 设计