樹莓派4B-遠程登錄和配置(putty和vnc)

結果:1.可以使用putty的shell中遠程登錄raspberry pi

                      

           2. 在筆記本端使用可視化界面操作raspberry pi

            

 

準備工作:

1.樹莓派4b

2.網線

3.筆記本電腦

putty遠程登錄配置

1.用網線把raspberry pi與筆記本電腦連接

2.打開筆記本的cmd,並輸入“arp -a”,查看本機連接的ip地址連接

3.在raspberry pi的shell中輸入“ifconfig”,查看連接的ip地址

4. 在筆記的cmd中ping raspberry pi,看網絡是否通暢

5.打開putty軟件,然後在host name中輸入raspberry pi的ip地址,點擊open,然後按照要求輸入user name和密碼

6. 安裝完畢,界面如下

 

vnc遠程登錄配置

1-4步驟和putty一樣

5.在raspberry pi上安裝vnc服務器,輸入”sudo apt-get install tightvncserver",安裝好之後輸入“vncpasswd”設置密碼

6.創建一個vnc服務器開機啓動的腳本,輸入“sudo nano /etc/init.d/tightvncserver”,拷貝下面的代碼到腳本中。如果USER名不是pi,則需要更改爲你本機的user名。

#!/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

7.修改vnc腳本的權限和啓動腳本

sudo chmod 755 /etc/init.d/tightvncserver
sudo update-rc.d tightvncserver defaults

8.在raspberry pi中手動啓動vnc

tightvncserver :1

9.在筆記本端打開vnc viewer軟件,並輸入raspberry pi的ip和控制檯號碼,比如8中的:1就是1號控制檯,點擊connect

10.輸入vnc密碼,即可打開可視界面

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章