CentOS 7.9 安装 TigerVNC

1.安装图形桌面

bash 复制代码
yum groupinstall -y "GNOME Desktop"

2.关闭SElinux

bash 复制代码
setenforce 0
sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config

3.关闭防火墙

bash 复制代码
systemctl stop firewalld
systemctl disable firewalld

4.安装 TigerVNC Server

bash 复制代码
yum install -y tigervnc-server tigervnc

5.修改配置文件

bash 复制代码
cat > /etc/systemd/system/vncserver@:1.service << EOF
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking
User=root
ExecStartPre=-/usr/bin/vncserver -kill %i
ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i"
PIDFile=/root/.vnc/%H%i.pid
ExecStop=-/usr/bin/vncserver -kill %i

[Install]
WantedBy=multi-user.target
EOF

6.设置 VNC 密码

bash 复制代码
vncpasswd

输入两次密码(不显示 ,直接敲),完成后会生成 ~/.vnc/

7.启动 VNC 并设开机自启

重载配置

bash 复制代码
systemctl daemon-reload

启动

bash 复制代码
systemctl start vncserver@:1.service

开机自启

bash 复制代码
systemctl enable vncserver@:1.service

查看状态

bash 复制代码
systemctl status vncserver@:1.service

8.测试连接

用TigerVNC Viewer客户端测试。

相关推荐
SelectDB1 天前
Litefuse 开源并推出单进程轻量模式,25 秒就能跑起来的 Agent 可观测与评估平台
运维·后端·自动化运维
AlfredZhao1 天前
Docker 容器时区不对,`timedatectl` 不存在怎么办?
linux·timezone
zzzzzz3103 天前
9K Star 炸裂开源!这个 C 语言写的代码知识图谱,把 Linux 内核索引压缩到了 3 分钟
linux·服务器·sql
XIAOHEZIcode3 天前
Linux系统鼠标偏移常见原因以及修复方案
linux·运维·游戏
用户0328472220703 天前
如何搭建本地yum源(上)
运维
A小辣椒4 天前
TShark:Wireshark CLI 功能
linux
A小辣椒5 天前
TShark:基础知识
linux
AlfredZhao5 天前
OCI 明明分配了 200G 系统盘,为什么 df 只看到 30G?
linux·oci
AlfredZhao5 天前
vi 删除指定范围的行,不用再反复按 dd
linux·vi
用户9718356334666 天前
银河麒麟 KY10 申威(SW64) 安装 nginx-1.16.1-2.p01.ky10.sw_64.rpm 详细步骤
linux