树莓派4B-远程登录和配置(putty和vnc)

结果:1.可以使用putty的shell中远程登录raspberry pi

                      树莓派4B-远程登录和配置(putty和vnc)_第1张图片

           2. 在笔记本端使用可视化界面操作raspberry pi

            树莓派4B-远程登录和配置(putty和vnc)_第2张图片

 

准备工作:

1.树莓派4b

2.网线

3.笔记本电脑

putty远程登录配置

1.用网线把raspberry pi与笔记本电脑连接

2.打开笔记本的cmd,并输入“arp -a”,查看本机连接的ip地址连接

树莓派4B-远程登录和配置(putty和vnc)_第3张图片

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

4. 在笔记的cmd中ping raspberry pi,看网络是否通畅

5.打开putty软件,然后在host name中输入raspberry pi的ip地址,点击open,然后按照要求输入user name和密码

树莓派4B-远程登录和配置(putty和vnc)_第4张图片

6. 安装完毕,界面如下

树莓派4B-远程登录和配置(putty和vnc)_第5张图片

 

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

树莓派4B-远程登录和配置(putty和vnc)_第6张图片

10.输入vnc密码,即可打开可视界面

树莓派4B-远程登录和配置(putty和vnc)_第7张图片

 

 

你可能感兴趣的:(树莓派,树莓派远程登录,putty,vnc登录)