本人需要安装vnc来登陆服务器。现在照以下这篇文章进行了安装和配置,但是运行总是报错。
https://blog.51cto.com/u_2221384/2535631
运行systemctl start vncserver@:1.service报错后查status,显示:
[root@VM-0-4-centos ~]# systemctl status vncserver@:1.service
● vncserver@:1.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver@:1.service; disabled; vendor preset: disabled)
Active: failed (Result: protocol) since 二 2022-05-03 22:50:22 CST; 5s ago
Process: 2209 ExecStart=/usr/sbin/runuser -l root -c /usr/bin/vncserver %i (code=exited, status=0/SUCCESS)
Process: 2206 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
5月 03 22:50:19 VM-0-4-centos systemd[1]: Starting Remote desktop service (VNC)...
5月 03 22:50:22 VM-0-4-centos systemd[1]: Can't open PID file /home/root/.vnc/VM-0-4-centos:1.pid (yet?) after start: No such file or directory
5月 03 22:50:22 VM-0-4-centos systemd[1]: Failed to start Remote desktop service (VNC).
5月 03 22:50:22 VM-0-4-centos systemd[1]: Unit vncserver@:1.service entered failed state.
5月 03 22:50:22 VM-0-4-centos systemd[1]: vncserver@:1.service failed.
问题大概率出现在这个PID文件上,因为我的默认service文件中没有教程中的那一行“PIDFile=/home/user/.vnc/%H%i.pid“,是我手动加上的。本人基本没接触过运维,还请大家指教