一.安装依赖与VNC Server
$ sudo apt-get install gnome-session-flashback
$ sudo apt-get install tigervnc-standalone-server
二.配置VNC使用环境
- 关闭防火墙与状态查看
$ sudo ufw disable
Firewall stopped and disabled on system startup
$ sudo ufw status
Status: inactive
- 设置VNC远程连接密码(习惯设为khadas
)
$ vncpasswd
Password:
Verify:
Would you like to enter a view-only password (y/n)? n
- 设置VNC服务启时运行的配置文件
$ vim ~/.vnc/xstartup
1 #!/bin/sh
2
3 unset SESSION_MANAGER
4 unset DBUS_SESSION_BUS_ADDRESS
5 export XKL_XMODMAP_DISABLE=1
6 export XDG_CURRENT_DESKTOP="GNOME-Flashback:GNOME"
7 export XDG_MENU_PREFIX="gnome-flashback-"
8 [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
9 [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
10 xsetroot -solid grey
11 vncconfig -iconic &
12 gnome-session --session=gnome-flashback-metacity --disable-acceleration-check &
- 为配置文件添加执行权限
$ sudo chmod +x ~/.vnc/xstartup
三.开启VNC服务端
$ vncserver -localhost no
- VNC正常开启显示
Cleaning stale pidfile '/home/khadas/.vnc/localhost:1.pid'!
New 'localhost:1 (khadas)' desktop at :1 on machine localhost
Starting applications specified in /home/khadas/.vnc/xstartup
Log file is /home/khadas/.vnc/localhost:1.log
Use xtigervncviewer -SecurityTypes VncAuth -passwd /home/khadas/.vnc/passwd :1 to connect to the VNC server.
- 查看端口号(为客户端连接做准备)----以下内容作参考
$ vncserver -list
X DISPLAY # RFB PORT # PROCESS ID
:1 5901 4323
四.现在可以打开你的客户端远程连接khadas
补充:
1.客户端下载:vnc view下载地址
2.连接格式:#示例192.168.1.172:5091
ps:有可能会遇到The connection closed unexpectedly(可以尝试解决这个小问题,有时间会更新)