Almalinux9开启VNC桌面

背景

安装了一台Almalinux9需要启动vnc的桌面连接

配置步骤

安装tigervnc

1
yum dnf install tigervnc-server

配置vnc密码

1
vncpasswd

配置vnc服务

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@lab4 ~]# cat /root/.vnc/config
## Supported server options to pass to vncserver upon invocation can be listed
## in this file. See the following manpages for more: vncserver(1) Xvnc(1).
## Several common ones are shown below. Uncomment and modify to your liking.
##
# securitytypes=vncauth,tlsvnc
# desktop=sandbox
# geometry=2000x1200
# localhost
# alwaysshared
session=gnome
securitytypes=vncauth,tlsvnc
geometry=1920x1080

配置用户

1
2
3
4
5
6
7
8
9
[root@lab4 ~]# cat /etc/tigervnc/vncserver.users
# TigerVNC User assignment
#
# This file assigns users to specific VNC display numbers.
# The syntax is <display>=<username>. E.g.:
#
# :2=andrew
# :3=lisa
:1=root

启动指定用户的vnc服务

1
[root@lab4 ~]# systemctl enable --now vncserver@:1

客户端连接

检查下端口,使用vnc的客户端就可以连接了

1
2
3
[root@lab4 ~]# netstat -tunlp|grep vnc
tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 4327/Xvnc
tcp6 0 0 :::5901 :::* LISTEN 4327/Xvnc

Almalinux9开启VNC桌面
https://zphj1987.com/2025/07/15/Almalinux9开启VNC桌面/
作者
zphj1987
发布于
2025年7月15日
许可协议