樹莓派命令行:linux
sudo apt-get install tightvncserver
安裝好以後請必定先使用此命令設置一個VNC密碼:shell
vncpasswd
(先輸入操做密碼兩次,而後會詢問是否設置一個查看(view-only)密碼,按本身喜歡,通常不必。)編輯器
設置開機啓動:ide
須要在/etc/init.d/中建立一個文件。例如tightvncserver(注:啓動腳本的名稱,有和程序名一致的習慣)。ui
sudo nano /etc/init.d/tightvncserver
內容以下:(putty窗口中按右鍵=粘貼)this
#!/bin/sh ### BEGIN INIT INFO # Provides: tightvncserver # Required-Start: $local_fs # Required-Stop: $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/stop tightvncserver ### END INIT INFO # More details see: # http://www.penguintutor.com/linux/tightvnc ### Customize this entry # Set the USER variable to the name of the user to start tightvncserver under export USER='pi' ### End customization required eval cd ~$USER case "$1" in start) # 啓動命令行。此處自定義分辨率、控制檯號碼或其它參數。 su $USER -c '/usr/bin/tightvncserver -depth 16 -geometry 800x600 :1' echo "Starting TightVNC server for $USER " ;; stop) # 終止命令行。此處控制檯號碼與啓動一致。 su $USER -c '/usr/bin/tightvncserver -kill :1' echo "Tightvncserver stopped" ;; *) echo "Usage: /etc/init.d/tightvncserver {start|stop}" exit 1 ;; esac exit 0
注:少數玩家默認用戶不是pi的請自行更改USER變量。
按Ctrl+X,回答Y(存盤)退出nano編輯器。
而後給tightvncserver文件加執行權限,並更新開機啓動列表。命令行
sudo chmod 755 /etc/init.d/tightvncserver sudo update-rc.d tightvncserver defaults
在Mac上訪問,先安裝VNC,而後鏈接時指定地址:vnc://192.168.1.123。code