摘自 https://www.cnblogs.com/crosys/p/6220471.html
1
| sudo nano /etc/init.d/vncserver
|
把下面的代码都复制进去
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
export USER='pi'
eval cd ~$USER
case "$1" in start) su $USER -c '/usr/bin/vncserver -depth 16 -geometry 1024x768 :1' echo "Starting VNC server for $USER " ;; stop) su $USER -c '/usr/bin/vncserver -kill :1' echo "vncserver stopped" ;; *) echo "Usage: /etc/init.d/vncserver {startstop}" exit 1 ;; esac exit 0
|
设置权限
1
| sudo chmod 755 /etc/init.d/vncserver
|
添加开机启动项
1
| sudo update-rc.d vncserver defaults
|
重启