Ubuntu 18.4 服务版 VNC 远程桌面连接

VNC 连接 Ubuntu 18 服务版。 即通过window 桌面操作系统 去远程控制 linux 。 那么VNC 就需要安装 服务端和 客户端。 

1: window 下安装 VNC 客户端:

http://www.realvnc.com/download/viewer

2:linux 下安装 VNC 服务端,这里选用 VNC 4 . 

sudo apt-get install vnc4server

3: 待安装完成之后 启动 VNC 服务

vncserver

注: 首次启动 需要设置密码 一般输入简单的 以防忘记 比如 123456 

ps -ef  | grep vnc4

4:待检查VNC 服务启动之后 ,在windows 启动客户端去连接

有上图日志可以看到   desktop is  shen:1  意思就是 端口号为1  .及 Ip:port 

5: 此时 连接之后发现是 灰色的 并且中间鼠标 为 X 且有unencrypted connection 的字样

 6: 到这里 VNC 的连接已经建立,只是无法 解析桌面环境。 所以还需要安装图形桌面应用 

gnome  , xfce ,kde  等等 任意安装一种。 这里推荐 使用 xfe4  或者 gnome 2

7:安装 xfce4 在ubuntu 

sudo apt-get install xfe4

安装之后 配置 vnc 的xstartup 文件 配置如下:

vi .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 &
#gnome-session &
#xubuntu-session &
#xfce4-terminal &
sesion-manager &xfdestop &xfce4-panel &
xfce4-menu-plugin &
xfsettingsd &
xfconfd &
xfwm4 &

8 :配置完成之后 , 使用reboot 命令 重启操作系统, 并且重新启动vncserver 然后 vncview 重新连接成功

猜你喜欢

转载自blog.csdn.net/kldyutou/article/details/86129634