树莓派入手先做的几件事情

具体型号差异参见:树莓派实验室的树莓派各版本对照表

装机

  1. 准备好要安装的系统镜像
    树莓派官方给的镜像列表
  2. 使用SD Formatter格式化SD卡
    SD Formatter官方下载地址
  3. 使用Etcher把镜像载到SD卡
    (需要注意镜像文件为img文件,请提前解压好)
    Etcher官方下载地址
  4. Flash完SD卡后,将SD卡装到树莓派上,连接电源即开机。

参见:https://www.raspberrypi.org/documentation/installation/installing-images/README.md

屏幕设置

参见微雪百科等官方文档。

在SD卡,config.txt写入:

max_usb_current=1
hdmi_group=2
hdmi_mode=87
hdmi_cvt 800 480 60 6 0 0 0
hdmi_drive=1

找到你的树莓派的IP

自己可以控制的局域网

  1. 在SD卡中创建空白的ssh
  2. 在SD卡中创建空白的wpa_supplicant.conf:
 country=CN 
 ctrl_interface=DIR=/var/run/wpa_supplicant 
 GROUP=netdev
 update_config=1   

network={ 
 ssid="WiFi-XXX" 
 psk="qwer1234"
 priority=1 
 scan_ssid=1
 }
  1. 下载Angry IP Scanner 扫一下 下载Angry IP Scanner 扫一下
    官方下载地址

受限制的局域网,如校网

如果你没有屏幕,但是可以读SD卡,请准备一根线,连接你的电脑和你的树莓派(以下简称“Pi”)

如果你有屏幕,也可以读SD卡,则不需要Pi直连电脑。

同一IP不同Pi (可能你重装了系统)

问题回报:

ECDSA host key “IP Address” for has changed and you have requested strict checking.

输入以下内容清除已经存储的公钥信息:

ssh-keygen -R "你的远程服务器ip地址"

参见:https://www.cnblogs.com/huiy/p/6230913.html

忘记密码

有屏幕 可以改SD卡

  1. 关机,拔卡,用电脑读卡
  2. 找到cmdline.txt文件,原内容应当如下:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

在rootwait末加入 init=/bin/sh,(不得换行)改为:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait init=/bin/sh```

问题:我的文件原内容并非如此 直接复制了上述内容)

  1. 安回SD卡,重新开机,停下时不要打回车,依次输入:
mount -o remount, rw /

等载入完后再输入

 passwd pi

修改完成后不要忘记输入:(否则硬盘会出错)

sync
exec /sbin/init
  1. 复原cmdline.txt文件

参见:https://howtoraspberrypi.com/recover-password-raspberry-pi/

su:鉴定故障

sudo passwd

直接改密码就好了

换pip和系统源

参见树莓派更换国内源

sudo nano /etc/apt/sources.list而后清空,键入

deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi

sudo nano /etc/apt/sources.list.d/raspi.list而后清空,键入

deb http://mirror.tuna.tsinghua.edu.cn/raspberrypi/debian stretch main ui
deb-src http://mirror.tuna.tsinghua.edu.cn/raspberrypi/debian stretch main ui

最后,一定要sudo apt-get update

参见更换pip源

sudo mkdir -p ~/.pip创建目录 , sudo nano ~/.pip/pip.conf修改配置文件,清空,输入

[global] 
index-url = https://mirrors.aliyun.com/pypi/simple/

[install]  
trusted-host= https://mirrors.aliyun.com/pypi/simple/  

后保存。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值