Linux下配置VNC远程桌面, 针对两种常用桌面xfce4和mate,亲测OK.
1. Ubuntu16.04 vnc4server+xfce4
参考 How To Install VNC Server On Ubuntu 14.04
修改~/.vnc/xstartup
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
2. Ubuntu 16.04 安装 VNC 及 Mate 桌面环境
修改~/.vnc/xstartup, 新增最后一行
#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &
mate-session &
[推荐] 后来 又尝试了下面:
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
mate-session &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
发现可以使用, 正常使用;而且要使用中文搜狗输入法, 需要手动打开fcitx, 然后切换, 不能直接用快捷键启动.
注: Ubuntu-Mate16.04本身就可以在**"系统语言=英文"的情况下,安装使用搜狗输入法v2.0**
[问题: vnc访问ok,但是物理机上进入系统,会弹出一个不正常的命令终端,虽然可以用命令’exit’直接退出,但是总归看着不爽]
[最新成果] 当前在用的:
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
/etc/X11/Xsession
可以直接在远程桌面开启的同时提供对中文输入法支持,且启动日志错误很少, 如下
Xvnc Free Edition 4.1.1 - built Feb 25 2015 23:02:21
Copyright (C) 2002-2005 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.
Underlying X server release 40300000, The XFree86 Project, Inc
Sun Nov 4 20:12:18 2018
vncext: VNC extension running!
vncext: Listening for VNC connections on port 5901
vncext: created VNC server for screen 0
error opening security policy file /etc/X11/xserver/SecurityPolicy
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/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!
Sun Nov 4 20:12:27 2018
Connections: accepted: 0.0.0.0::58856
SConnection: Client needs protocol version 3.8
SConnection: Client requests security type VncAuth(2)
VNCSConnST: Server default pixel format depth 16 (16bpp) little-endian rgb565
VNCSConnST: Client pixel format depth 6 (8bpp) rgb222
Sun Nov 4 20:12:28 2018
VNCSConnST: Client pixel format depth 16 (16bpp) little-endian rgb565
AUDIT: Sun Nov 4 20:17:29 2018: 53449 Xvnc4: client 26 rejected from local host
效果图
Mate其它:
Linux Mint - vnc4server - start full mate session
How to make VNC Server work with ubuntu-desktop without xfce
vnc xstartup for MATE桌面
待解决问题:
求助 VNC连接Ubuntu无法使用输入法fcitx