centos7安装tigervnc-server服务并且黑屏的解决方法

1.下载三个包,传到/root下面

centos7安装tigervnc-server服务并且黑屏的解决方法

2.依次安装

centos7安装tigervnc-server服务并且黑屏的解决方法

3.复制文件

cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service

4.因为我有两个两个用户,一个是root ,另外一个是普通用户,我决定让普通用户使用vnc,那么编辑

/etc/systemd/system/vncserver@:1.service这个文件,将其中的<user>改为普通用户名即可

vim /etc/systemd/system/vncserver@:1.service

centos7安装tigervnc-server服务并且黑屏的解决方法

5.切换到普通用户,设置vncpasswd

centos7安装tigervnc-server服务并且黑屏的解决方法

6.切换到root,启动vnc服务

[root@ ~]# systemctl daemon-reload
[root@ ~]# systemctl start vncserver@:1.service
[root@ ~]# systemctl enable vncserver@:1.service
[root@ ~]# systemctl status vncserver@:1.service
● vncserver@:1.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver@:1.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2022-07-22 14:27:34 CST; 9min ago
Main PID: 380762 (vncserver_wrapp)
CGroup: /system.slice/system-vncserver.slice/vncserver@:1.service
├─ 22539 sleep 5
└─380762 /bin/sh /usr/bin/vncserver_wrapper cdssadmin :1

Jul 22 14:27:34 hm-db systemd[1]: Starting Remote desktop service (VNC)...
Jul 22 14:27:34 hm-db systemd[1]: Started Remote desktop service (VNC).
Jul 22 14:27:37 hm-db vncserver_wrapper[380762]: New 'hm-db:1 (cdssadmin)' desktop is hm-db:1
Jul 22 14:27:37 hm-db vncserver_wrapper[380762]: Starting applications specified in /home/cdssadmin/.vnc/xstartup
Jul 22 14:27:37 hm-db vncserver_wrapper[380762]: Log file is /home/cdssadmin/.vnc/hm-db:1.log
Jul 22 14:27:42 hm-db vncserver_wrapper[380762]: 'vncserver :1' has PID 380786, waiting until it exits ...
[root@ ~]# netstat -lnpt|grep Xvnc
tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 380786/Xvnc
tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN 380786/Xvnc
tcp6 0 0 :::5901 :::* LISTEN 380786/Xvnc
tcp6 0 0 :::6001 :::* LISTEN 380786/Xvnc

7.问题,启动后,用vnc viewer能连接上,但是

黑屏,查看日志发现此处错误:

centos7安装tigervnc-server服务并且黑屏的解决方法

8.删掉/run/user/100[root@hm-db ~]# rm /run/user/1002/dconf/user

[root@ ~]# rm /run/user/1002/dconf/user
rm: remove regular file ‘/run/user/1002/dconf/user’? y

9.接着就正常了。

发表评论

相关文章