树莓派3B+ 安装系统

我就是我 2022-06-06 02:54 493阅读 0赞

树莓派3B+ 安装系统


对于树莓派3B+ 系统安装方法有很多,我就介绍比较普通的一种。适合小白操作!


安装概要步骤: 官网下载系统-》刷入TF卡-》设置开启显示器和SSH-》通电-》进入系统


1. 进入官方网站下载系统镜像。

下载页面:https://www.raspberrypi.org/downloads/

这里写图片描述

来到下面这个页面

这里写图片描述

如果感觉下载速度慢,可以将下载链接放到迅雷里面下,基本可以做到满速下载!

如果你对我后续的博文有兴趣,建议和我下载相同版本:
stretch版 (基于Debian 9): 2017-09-07-raspbian-stretch.zip 或 2017-09-07-raspbian-stretch-lite.zip
更老版 jessie (基于Debian 8):2017-06-21-raspbian-jessie.zip 和 2017-06-21-raspbian-jessie-lite.zip

下载完成后,是一个压缩包,大概1.76G,我们将其解压,得到2017-09-07-raspbian-stretch.img格式文件,大概4.92G。
如果你下载的是轻量版,解压后大概就是1.7G,可以装到4G到TF卡上。(在这里建议大家用32G及以上容量的TF卡,因为内存越大,传输速度也是更快的)。


2.Windows系统下的安装:(非wind系统请往下看)


2.1)首先将准备好的TF卡连接读卡器,插入电脑

2.2)下载一个格式化SD卡的工具,格式化SD卡

下载网址:https://www.sdcard.org/downloads/formatter_4/eula_windows/ (点击Aceept开始下载)

这里写图片描述

2.3)下载Win32 DiskImager,这是一个把镜像写入SD卡的工具

下载网址:http://sourceforge.net/projects/win32diskimager/

这里写图片描述

这一步首先选择你的raspberry.img系统镜像包,然后选择你的TF卡,点击Write就会开始工作了,大概3~4分钟左右。


2.MAC系统下的安装(其它Linux系统都可以的):


2.1)首先将准备好的TF卡连接读卡器,插入电脑

2.2)打开终端(Terminal),查看当前已挂载的卷:

  1. [kxwinxp@MacBook]$ df -h
  2. Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
  3. /dev/disk1 112Gi 81Gi 30Gi 73% 1014786 4293952493 0% /
  4. devfs 188Ki 188Ki 0Bi 100% 654 0 100% /dev
  5. map -hosts 0Bi 0Bi 0Bi 100% 0 0 100% /net
  6. map auto_home 0Bi 0Bi 0Bi 100% 0 0 100% /home
  7. /dev/disk2s3 92Gi 51Gi 41Gi 56% 336662 42525054 1% /Volumes/系统
  8. /dev/disk2s4 20Gi 15Gi 4.4Gi 78% 92859 4579733 2% /Volumes/数据
  9. /dev/disk3s1 29Gi 2.3Mi 29Gi 1% 107876 8373436 2% /Volumes/未命名

对比Size和Name可以找到SD卡的分区在系统里对应的设备文件(这里是/dev/disk3s1),如果你有多个分区,可能还会有disk3s2之类的。

2.3)使用diskutil unmount将这些分区卸载:

  1. [kxwinxp@MacBook]$ diskutil unmount /dev/disk3s1
  2. Volume 未命名 on disk3s1 unmounted

2.4)先对下载的zip压缩包进行解压,然后使用dd命令将系统镜像写入,需要特别特别注意disk后的数字,不能搞错!

(说明:/dev/disk3s1是分区,/dev/disk3是块设备,/dev/rdisk3是原始字符设备)

  1. [kxwinxp@MacBook]$ unzip 2017-09-07-raspbian-stretch.zip
  2. [kxwinxp@MacBook]$ sudo dd bs=16m if=2017-09-07-raspbian-stretch.img of=/dev/rdisk3
  3. _
  4. 输入用户密码

经过几分钟的等待,出现下面的提示,说明TF卡刷好了:

  1. 1172+1 records in
  2. 1172+1 records out
  3. 4916019200 bytes transferred in 127.253638 secs (9691442 bytes/sec)

好了,系统已经刷入TF卡了。


3. 现在对TF卡数据进行预设置(Win和Mac)下同操作。

在电脑显示的盘中可以看到一个移动分区为FAT32格式,打开:

这里写图片描述

3.1)开启SSH远程:(自2016年9月开始,raspberry默认关闭ssh连接)

在TF卡分区里面创建一个名为 “ssh” 空文件即可(不要有txt后缀!)

3.2)开启强制HDMI输出:(很多现在的显示器在树莓派上并不能识别)

在TF卡分区,打开config.txt文件(开机后位置: /boot/config.txt),修改如下:

  1. hdmi_safe=1
  2. config_hdmi_boost=4
  3. hdmi_ignore_edid=0xa5000080
  4. hdmi_group=2
  5. hdmi_mode=82

一些参数介绍:


















































含义
hdmi_safe=1 安全启动HDMI
config_hdmi_boost=4 开启热插拔
hdmi_group=1 CEA电视显示器
hdmi_group=2 DMT电脑显示器
hdmi_ignore_edid=0xa5000080 忽略自动探测的分辨率
输出分辨率:
hdmi_mode=4 640x480 60Hz
hdmi_mode=9 800x600 60Hz
hdmi_mode=16 1024x768 60Hz
hdmi_mode=82 1080p 60Hz

3.3)设置无线WI-FI连接:(假如你没有网线,而且没能连接显示器)

在TF卡的boot分区,创建wpa_supplicant.conf文件,加入如下内容:

  1. country=CN
  2. ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
  3. update_config=1
  4. network={
  5. ssid="feng"
  6. psk="peng123456"
  7. priority=1
  8. }

在树莓派通电后会自动添加到/etc/wpa_supplicant/wpa_supplicant.conf文件里面,进行自动连接。

  1. // 详细介绍:
  2. #ssid:网络的ssid
  3. #psk:密码
  4. #priority:连接优先级,数字越大优先级越高(不可以是负数)
  5. #scan_ssid:连接隐藏WiFi时需要指定该值为1
  6. // 如果你的 WiFi 没有密码
  7. network={
  8. ssid="你的无线网络名称(ssid)"
  9. key_mgmt=NONE
  10. }
  11. // 如果你的 WiFi 使用WEP加密
  12. network={
  13. ssid="你的无线网络名称(ssid)"
  14. key_mgmt=NONE
  15. wep_key0="你的wifi密码"
  16. }
  17. // 如果你的 WiFi 使用WPA/WPA2加密
  18. network={
  19. ssid="你的无线网络名称(ssid)"
  20. key_mgmt=WPA-PSK
  21. psk="你的wifi密码"
  22. }

在基本的设置完成后,我们将TF卡插入树莓派,通电。

3.4)进入树莓派系统

提示:如果你没有显示器,你就需要登录路由器进行查看树莓派的IP地址,或者在电脑里面扫描局域网中的设备,找到树莓派的IP地址,然后进行SSH连接。

Windows里面需要下载软件,可使用Putty软件(或者Xshell)。

Putty

MAC里面可以直接使用 ssh pi@192.168.1.* 命令进行连接

登录账号:用户名:pi 密码:raspberry

假如出现这种情况:

  1. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  2. @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
  3. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  4. IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
  5. Someone could be eavesdropping on you right now (man-in-the-middle attack)!
  6. It is also possible that a host key has just been changed.
  7. The fingerprint for the ECDSA key sent by the remote host is
  8. SHA256:EqIFQoWYDISyGnJggyqnk8888LeNn3tr1+QmBQaso0.
  9. Please contact your system administrator.
  10. Add correct host key in /Users/caolijian/.ssh/known_hosts to get rid of this message.
  11. Offending ECDSA key in /Users/caolijian/.ssh/known_hosts:12
  12. ECDSA host key for 192.168.1.112 has changed and you have requested strict checking.
  13. Host key verification failed.

则是需要清理一下之前保存的认证密钥。

  1. // 查看
  2. ssh-keygen -l -f ~/.ssh/known_hosts
  3. // 清理192.168.1.112的认证rsa
  4. ssh-keygen -R 192.168.1.112

成功进入的界面:

  1. Linux raspberrypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l
  2. The programs included with the Debian GNU/Linux system are free software;
  3. the exact distribution terms for each program are described in the
  4. individual files in /usr/share/doc/*/copyright.
  5. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
  6. permitted by applicable law.
  7. Last login: Fri Nov 3 08:36:37 2017
  8. SSH is enabled and the default password for the 'pi' user has not been changed.
  9. This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.
  10. pi@raspberrypi:~ $
  11. // 查看莓派版本信息
  12. cat /proc/cpuinfo

系统初次进入后,首先修改软件源(避免下载失败,让软件下载更快,)

网址:http://blog.csdn.net/kxwinxp/article/details/78370980


4.其它的一些设置和程序

4.1) 校正树莓派时间

  1. // 设置时区为 亚洲(Asia) 上海(Shanghai)
  2. sudo dpkg-reconfigure tzdata
  3. // 启动 NTP 使计算机时钟与 Internet 时间服务器同步
  4. sudo timedatectl set-ntp true

4.2)改变键盘布局

树莓派(raspberry pi)是英国产品,默认键盘布局是英国(UK),我们用的键盘布局一般是美国(US)。

  1. // 进入设置页面 方法一
  2. sudo dpkg-reconfigure keyboard-configuration
  3. // 进入设置页面 方法二
  4. sudo raspi-config
  5. // 选择 4 Localisation Options -> I3 Change Keyboard Layout

通用的101键PC键盘-> English(US) -> English(US, alternative international) -> OK

4.3)vnc远程屏幕软件

  1. // (基于Debian 9)直接执行
  2. sudo apt-get install -y xrdp
  3. // (基于Debian 8)请执行如下
  4. sudo apt-get install -y tightvncserver xrdp

安装完成后就可以用Windows自带的远程软件进行远程桌面(用户名:pi 密码:raspberry)。

效果如下:
home

发表评论

表情:
评论列表 (有 0 条评论,493人围观)

还没有评论,来说两句吧...

相关阅读