安装图形界面
sudo apt update
sudo apt install ubuntu-desktop
安装和配置 VNC 服务器
sudo apt install tightvncserver
设置 VNC 密码:
运行以下命令来设置 VNC 密码(需要输入和确认密码):
vncserver
使用 ps -ef | grep vnc
查看是否启动并查看使用端口号
可以看到服务已正常启动,并且使用的是5901端口。
编辑 VNC 服务器配置文件:
nano ~/.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-panel &
gnome-settings-daemon &
metacity &
nautilus &
下载VNC Viewer
Download VNC Viewer by RealVNC®
点击File -> New connection
配置
点击ok,双击打开