无法让VNC服务器在CentOS 7.4中工作

我使用Gnome运行CentOS 7.4,并且在VNC服务器为客户端提供桌面环境时遇到问题。 我要么得到一个空白的黑屏或带有checkbox的文本。 它正在运行VNC:

Xvnc TigerVNC 1.8.0 - built Aug 7 2017 01:32:32 

如果我使用我的主目录中提供的.vnc / xstartup:

 #!/bin/sh unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS exec /etc/X11/xinit/xinitrc 

它被提示input密码,但它只是提供一个空白的黑屏。 它根本不存在。 当我从控制台login到这个相同的帐户,它工作得很好。

我的VNC服务器在一个现在已经退役的CentOS 6系统上工作,所以我决定尝试从那个版本的xstart:

 #!/bin/sh vncconfig -iconic & unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS OS=`uname -s` if [ $OS = 'Linux' ]; then case "$WINDOWMANAGER" in *gnome*) if [ -e /etc/SuSE-release ]; then PATH=$PATH:/opt/gnome/bin export PATH fi ;; esac fi if [ -x /etc/X11/xinit/xinitrc ]; then exec /etc/X11/xinit/xinitrc fi if [ -f /etc/X11/xinit/xinitrc ]; then exec sh /etc/X11/xinit/xinitrc fi [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & #twm & exec gnome-session & 

但是,这会产生灰色屏幕的客户与下面的checkbox和文本:

 Accept clipboard from viewers Also set primary selection Send clipboard to viewers Send primary selection to viewers 

我可以检查和取消选中这些框,但就是这样。 根据我见过的CentOS 7文章和文档,不要得到我编辑的桌面环境:

这里是/etc/systemd/system/vncserver@:1.service文件:

 # The vncserver service unit file # # Quick HowTo: # 1. Copy this file to /etc/systemd/system/[email protected] # 2. Replace <USER> with the actual user name and edit vncserver # parameters appropriately # ("User=<USER>" and "/home/<USER>/.vnc/%H%i.pid") # 3. Run `systemctl daemon-reload` # 4. Run `systemctl enable vncserver@:<display>.service` # # DO NOT RUN THIS SERVICE if your local area network is # untrusted! For a secure way of using VNC, you should # limit connections to the local host and then tunnel from # the machine you want to view VNC on (host A) to the machine # whose VNC output you want to view (host B) # # [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB # # this will open a connection on port 590N of your hostA to hostB's port 590M # (in fact, it ssh-connects to hostB and then connects to localhost (on hostB). # See the ssh man page for details on port forwarding) # # You can then point a VNC client on hostA at vncdisplay N of localhost and with # the help of ssh, you end up seeing what hostB makes available on port 590M # # Use "-nolisten tcp" to prevent X connections to your VNC server via TCP. # # Use "-localhost" to prevent remote VNC clients connecting except when # doing so through a secure tunnel. See the "-via" option in the # `man vncviewer' manual page. [Unit] Description=Remote desktop service (VNC) After=syslog.target network.target [Service] Type=forking User=justme # Clean any existing files in /tmp/.X11-unix environment ExecStartPre=-/usr/bin/vncserver -kill %i ExecStart=/usr/bin/vncserver %i PIDFile=/home/justme/.vnc/%H%i.pid ExecStop=-/usr/bin/vncserver -kill %i [Install] WantedBy=multi-user.target 

我查看了日志文件,我看到的唯一的错误/警告是:

 [root@myserver ~]# 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: inactive (dead) since Wed 2017-10-11 05:04:32 EDT; 21min ago Process: 2456 ExecStop=/usr/bin/vncserver -kill %i (code=exited, status=0/SUCCESS) Process: 1410 ExecStart=/usr/bin/vncserver %i (code=exited, status=0/SUCCESS) Process: 1358 ExecStartPre=/usr/bin/vncserver -kill %i (code=exited, status=2) Main PID: 1570 (code=exited, status=0/SUCCESS) Oct 11 05:01:31 myserver vncserver[1358]: Can't find file /home/justme/.vnc/myserver:1.pid Oct 11 05:01:31 myserver vncserver[1358]: You'll have to kill the Xvnc process manually Oct 11 05:01:34 myserver vncserver[1410]: New 'myserver:1 (justme)' desktop is myserver:1 Oct 11 05:01:34 myserver vncserver[1410]: Starting applications specified in /home/justme/.vnc/xstartup Oct 11 05:01:34 myserver vncserver[1410]: Log file is /home/justme/.vnc/myserver:1.log Oct 11 05:01:34 myserver systemd[1]: Started Remote desktop service (VNC). Oct 11 05:01:34 myserver gnome-session[1952]: gnome-session-binary[1952]: **WARNING: software acceleration check failed: Child process exited with code 1** Oct 11 05:01:34 myserver gnome-session-binary[1952]: WARNING: software acceleration check failed: Child process exited with code 1 Oct 11 05:04:32 myserver vncserver[2456]: Killing Xvnc process ID 1570 Oct 11 05:04:32 myserver vncserver[2456]: Xvnc process ID 1570 already killed 

我已经做了一些更改xstartup和etc / systemd / system / vncserver @:1.service文件的尝试,但是除了空白的空白屏幕或带有checkbox的空白屏幕之外,没有一个产生任何结果。

如果有经验的人有更多的疑难问题的build议,或者你能看到问题是什么,请提出你的想法。

CentOS / RHEL 7 VNC安装有相当不错的方法:

https://www.linuxtechi.com/install-configure-vnc-server-centos-7-rhel-7/

根据评论和事实,我几天前准备的基于Fedora 25的VNC服务器的步骤非常相似,我相信它应该适合你。

在按照https://www.linuxtechi.com/install-configure-vnc-server-centos-7-rhel-7/的说明操作之后,它仍然无法工作&#x3002; 我在这里logging解决scheme,以防其他人遇到这种情况。

解决scheme:删除Nvidia驱动程序,并用xorg-x11-drv-nouveaureplace。 这解决了这个问题。 这是我如何删除它: https : //ask.fedoraproject.org/en/question/78969/how-to-remove-the-nvidia-proprietary-driver/

之后,我做了一些search,看到提到的Nvidia驱动程序打破了VNC,即使它对有线显示器工作正常。