root用户Linux银河麒麟服务器安装vnc服务

安装必要桌面环境组件

bash 复制代码
yum install mate-session-manager -y
mate-session #确定是否安装成功

安装vnc服务器

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

切换到root为root得vnc设置密码

bash 复制代码
su root
vncpasswd

给root用户设置vnc服务器文件

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

[Service]
Type=forking
User=root
Group=root
WorkingDirectory=/root
Environment="HOME=/root"
ExecStart=/usr/bin/vncserver -autokill :1
ExecStop=/usr/bin/vncserver -kill :1

[Install]
WantedBy=multi-user.target

重新加载服务器文件

bash 复制代码
systemctl daemon-reload

编辑vnc启动脚本文件

bash 复制代码
[root@localhost system]# cat /root/.vnc/xstartup

#!/bin/bash
xrdb $HOME/.Xresources
export XKL_XMODMAP_DISABLE=1

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec /usr/bin/mate-session

启动vnc服务

bash 复制代码
systemctl start vncserver@:1

查看启动是否成功

bash 复制代码
systemctl status vncserver@:1

查看vnc启动日志情况

bash 复制代码
cat /root/.vnc/localhost.localdomain:1.log
相关推荐
Avan_菜菜2 小时前
FRP 内网穿透完整实战:从 HTTP 映射到 HTTPS 自签代理
运维·nginx·https
Sokach101511 小时前
Linux Shell 脚本从零到能用:一个新手的一天学习总结
linux
SelectDB1 天前
Litefuse 开源并推出单进程轻量模式,25 秒就能跑起来的 Agent 可观测与评估平台
运维·后端·自动化运维
AlfredZhao1 天前
Docker 容器时区不对,`timedatectl` 不存在怎么办?
linux·timezone
zzzzzz3102 天前
9K Star 炸裂开源!这个 C 语言写的代码知识图谱,把 Linux 内核索引压缩到了 3 分钟
linux·服务器·sql
XIAOHEZIcode2 天前
Linux系统鼠标偏移常见原因以及修复方案
linux·运维·游戏
用户0328472220703 天前
如何搭建本地yum源(上)
运维
A小辣椒4 天前
TShark:Wireshark CLI 功能
linux
A小辣椒4 天前
TShark:基础知识
linux
AlfredZhao5 天前
OCI 明明分配了 200G 系统盘,为什么 df 只看到 30G?
linux·oci