1.安装vino
sudo apt update
sudo apt install vino
2.配置VNC服务
sudo ln -s ../vino-server.service /usr/lib/systemd/user/graphical-session.target.wants
gsettings set org.gnome.Vino prompt-enabled false
gsettings set org.gnome.Vino require-encryption false
额外添加并手动启动VNC Service:
sudo vi /usr/share/glib-2.0/schemas/org.gnome.Vino.gschema.xml
在文件最后添加以下内容:
<key name='enabled' type='b'>
<summary>Enable remote access to the desktop</summary>
<description>
If true, allows remote access to the desktop via the RFB
protocol. Users on remote machines may then connect to the
desktop using a VNC viewer.
</description>
<default>true</default>
</key>
重新编译:
sudo glib-compile-schemas /usr/share/glib-2.0/schemas
3.设置VNV登录密码
gsettings set org.gnome.Vino authentication-methods "['vnc']"
gsettings set org.gnome.Vino vnc-password $(echo -n '12345678'|base64)
4.设置开机自启动VNC Server
gsettings set org.gnome.Vino enabled true
mkdir -p ~/.config/autostart
nano ~/.config/autostart/vino-server.desktop
文件中添加以下内容:
[Desktop Entry]
Type=Application
Name=Vino VNC server
Exec=/usr/lib/vino/vino-server
NoDisplay=true
5.设置桌面分辨率
sudo nano /etc/X11/xorg.conf
文件最后添加如下内容,修改VNC分辨率为1920x1080:
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Tegra0"
SubSection "Display"
Depth 24
Virtual 1920 1080 # Modify the resolution by editing these values
EndSubSection
EndSection
重启系统后使用VNC连接:
sudo reboot now