1、VNC安装后启动总是失败
[root@localhost tmp]# systemctl restart vncserver@:1.service
Job for vncserver@:1.service failed. See 'systemctl status vncserver@:1.service' and 'journalctl -xn' for details.
答:根据提示,用'journalctl -xn'命令查看错误信息,信息如下:
7鏈24 09:15:10 localhost.localdomain runuser[5609]: pam_unix(runuser-l:session): session opened for user root by (uid=0)
7鏈24 09:15:10 localhost.localdomain runuser[5609]: Warning: localhost.localdomain:1 is taken because of /tmp/.X11-unix/X1
7鏈24 09:15:10 localhost.localdomain runuser[5609]: Remove this file if there is no X server localhost.localdomain:1
7鏈24 09:15:10 localhost.localdomain runuser[5609]: A VNC server is already running as :1
7鏈24 09:15:10 localhost.localdomain runuser[5609]: pam_unix(runuser-l:session): session closed for user root
7鏈24 09:15:10 localhost.localdomain systemd[1]: vncserver@:1.service: control process exited, code=exited status=2
7鏈24 09:15:10 localhost.localdomain systemd[1]: Failed to start Remote desktop service (VNC).
网上查了一下,删除.X11-unix文件夹就好,我试验的结果时,.X11-unix这个目录也要删除,否则还是会失败。
删除了再启动,就OK了。
2、防火墙关闭
CentOS7的防火墙不是iptables,是firewall,所以命令改了变成
启动防火墙 systemctl start firewalld.service
关闭防火墙 systemctl stop firewalld.service
开机启动防火墙 systemctl enable firewalld.service
禁止开机启动防火墙 systemctl disable firewalld.service