https://www.alibabacloud.com/help/zh/faq-detail/59330.htm#h2-1-ubuntu-1

安装 VNC

  1. sudo apt-get install vnc4server

启动 VNC

  1. vncserver

image.png

依赖项

  1. sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal

修改配置

  1. vi ~/.vnc/xstartup
  1. #!/bin/sh
  2. # Uncomment the following two lines for normal desktop:
  3. # unset SESSION_MANAGER
  4. # exec /etc/X11/xinit/xinitrc
  5. #[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
  6. #[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
  7. #xsetroot -solid grey
  8. #vncconfig -iconic &
  9. #x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
  10. #x-window-manager &
  11. export XKL_XMODMAP_DISABLE=1
  12. unset SESSION_MANAGER
  13. unset DBUS_SESSION_BUS_ADDRESS
  14. [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
  15. [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
  16. xsetroot -solid grey
  17. vncconfig -iconic &
  18. gnome-session &
  19. gnome-panel &
  20. gnome-settings-daemon &
  21. metacity &
  22. nautilus &
  23. gnome-terminal &

关闭已经打开的 vncserver

  1. vncserver -kill :1

image.png

打开 vncserver

  1. vncserver -geometry 1366x768 :1

image.png