1.在Ubuntu上首先需要安装vnc4server
# apt-get install vnc4server
2.第一次执行vncserver的时候需要为客户端连接设置6位的密码
# vncserver
password:
3.在vnc客户端(noVNC/vncviewer)中远程链接IP:1,但是输入密码后显示灰屏并且鼠标为x型
这是因为vncserver在Ubuntu系统中找不到指定的图形化工具
此时需要在Ubuntu中下载图形化工具
# apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
连接之后
上面显示三个复选框:Accept clipboard from viewers; Send clipboard to viewers; Sendprimary selection to viewers.并未显示Gnome的桌面。
需要安装完成之后需要更改~/.vnc/xstartup文件,添加如下内容:
# vim ~/.vnc/xstartup
export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
gnome-panel &
gnmoe-settings-daemon &
metacity &
nautilus &
gnome-terminal &
4.之后重启vncserver就OK了
# vncserver :2
注:
停止某个vnc服务
# vncserver -kill :端口号
调节分辨率,直接输入就可以了,他会自动新生成一个端口
vncserver -geometry 1920x1080
还有这个错误的,cat /home/用户名/.vnc/*.log
error opening security policy file /etc/X11/xserver/SecurityPolicy
Could not init font path element /usr/X11R6/lib/X11/fonts/Type1/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/Speedo/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/misc/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/75dpi/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/100dpi/, removing from list!
Could not init font path element /usr/share/fonts/X11/75dpi/, removing from list!
Could not init font path element /usr/share/fonts/X11/100dpi/, removing from list!
如果出现的话,改改路径
原因:vncserver默认寻找的X系统的字体路径在/usr/X11R6/lib/X11/fonts/下,但RHEL5却在/usr /share/X11/fonts/下
我是直接全复制过去了,软链接好像没用,不知道为啥。
参考:https://blog.csdn.net/kkk8000/article/details/6172698
不显示菜单栏,主要是anaconda的原因,需要退出这个环境再运行生成端口
先输入 conda deactivate 退出虚拟环境
然后再这样调成这个分辨率就好
vncserver -geometry 1920x1080
就能正常显示了,这个原因太服气了
ubuntu系统显示灰屏解决方案参考:
https://blog.csdn.net/jx18080136806/article/details/80239134?utm_medium=distribute.pc_relevant.none-task-blog-baidulandingword-1&spm=1001.2101.3001.4242
不显示命令行和菜单栏解决方法参考:
https://blog.csdn.net/c_watermelon_y/article/details/95990351