树莓派3M安装及入门

树莓派开机指南

因为参考大佬视频及一位已经采坑过的姐妹帮助最终完成开机及配置
大佬视频:
https://www.bilibili.com/video/BV1ab411x7aC(虽然是19年的视频但是还是挺值得参考的)
姐妹博客:https://blog.csdn.net/weixin_43626669/article/details/113828921spm=1001.2014.3001.5502



前言

我用的是树莓派3M,买了计算模块再买的底板(因为一开始想着自己画后来太懒还是选择了淘宝真香),32GSD卡(大佬视频说一定要16g其实不是的,好像大于32g才要弄别的东西),鼠标键盘什么的都有,我也用的无线网卡,显示器可有可无吧,因为后面都是弄的远程工具。


一、软件准备

可以直接去下载视频大佬百度网盘里的东西,需要的基本都有了,但是系统版本是19年的,需要新版本可以自己去下载。我怕以后没了,挂了我百度网盘里的
百度网盘链接:https://pan.baidu.com/s/1mBplGeqc7CTSsuDGffUOig
提取码:nch0
树莓派官网:https://www.raspberrypi.org/software/raspberry-pi-desktop/
要下载带桌面的,下载之后是一个.img的文件

二、配置过程

一回生二回熟

1.SD卡和系统安装

如果SD卡是空的可以直接装系统,如果不是空的要进行格式化

如果第一次格式化失败,进行第二次,无影响(别格式化错了盘)
在这里插入图片描述

用Win32DiskImager把.img文件写入SD卡。
在这里插入图片描述

2.一些文件配置

  1. ssh文件
    新建txt文本文件,改成ssh删除.txt后缀就ok,就是空文件
  2. wpa_supplicant.conf文件
    与ssh文件同理,但是文件不为空,因为这个用来连接无线网络的
country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
   ssid="WIFI或者手机热点名字"
   psk="密码"
   priority=优先级数字越大越高
}
network={
   ssid="h3rich"
   psk="rich1187"
   priority=4
}

即使是手机热点也可以用这个,没影响的

  1. config.txt文件

用显示屏就需要修改该文件

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
hdmi_group=2
hdmi_mode=9

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
#dtoverlay=vc4-fkms-v3d
#max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d
dtoverlay=w1-gpio

这两个就是修改以匹配显示屏,如果没打算接也可以不用改,我当时试了一下1080p的,60Hz,配置如下

hdmi_group=16
hdmi_mode=82

修改可以参考链接:https://shumeipai.nxez.com/2013/08/31/custom-display-resolution-raspberry-pie.html


三、开机

1.有屏幕

有屏幕就比较简单,不过要记得接上屏幕再上电,不然会无反应,第一次开机会比较慢,不过可以骚等。默认的用户名是pi,密码是raspberry。先获取树莓派的IP地址,把鼠标悬停到WiFi图标上就可以看到,也可以用命令行查看,这个可以自己看视频(但是可以直接看为什么要查),

2.无屏幕

无屏幕就要使用远程工具,butty没有界面,是直接看到的命令行,putty直接输入IP地址回车就ok。(第一次因为我SD卡不知道怎么回事掉了,大无语,一直网络问题连不上,但是WiFi能连上,但是WiFi密码在SD卡,也可能是读取一次就ok,直到现在那卡也不知道掉哪了,我怀疑被树莓派吃了,因为我拿着移动不到两平方米)所以还是用VNC viewer吧能直接看到界面。但是首先要解决一个问题,如何获取IP地址,可以用路由器软件查,也可以用百度网盘001基本工具\局域网IP扫描器\Advanced IP Scanner里的advanced_ip_scanner,先在电脑命令行ipconfig查出自己的 IPv4 地址如192.168.43.7,查找时就筛选一下,查的快
在这里插入图片描述
像我这第三个就是树莓派,我这是手机热点,这样就可以获取IP地址
手机热点的话有的手机上可以看到连接设备的IP地址有的看不到,我的不能。
https://jackpal.github.io/Android-Terminal-Emulator/downloads/Term.apk
下载这个软件输入ip neigh就可以查到同一个网络上的设备,类似于上面那个软件

3.Putty

前期要设置VNC(本来想不讲但是最后发现还是要讲,无语)
参考链接:https://shumeipai.nxez.com/2018/08/31/raspberry-pi-vnc-viewer-configuration-tutorial.html
在这里插入图片描述
默认的用户名:pi,默认密码:raspberry
在这里插入图片描述
当前页面输入:sudo raspi-config 进入(方向键选择)

在这里插入图片描述
回车进入
在这里插入图片描述
回车
在这里插入图片描述
选是,回车
在这里插入图片描述
VNC配置完成。

4.VNC viewer

直接输入IP地址
在这里插入图片描述
回车
在这里插入图片描述
输入密码就是原始密码,上面那个
在这里插入图片描述
完成,而且记得调分辨率(sudo raspi-config→display option→Resolution),我用了一天才发现大无语

四、一劳永逸配置

1.Raspbian的包管理apt-get换源

命令行输入

sudo nano /etc/apt/sources.list

在这里插入图片描述
将默认官方地址注释换成清华镜像,其他地方的镜像也ok
大佬的视频链接里已经是旧的清华镜像源现在已经换了。

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

在这里插入图片描述
Ctrl+o后回车保存,Ctrl+x退出
命令行界面输入以下命令更新清华镜像源最新软件列表

sudo apt-get update
sudo apt-get upgrade

之后也可以用sudo apt-get install 软件名 通过清华镜像源下载
更换系统源

sudo nano /etc/apt/sources.list.d/raspi.list#注释掉原文件内容用以下内容取代:用#注释掉原文件内容,用以下内容取代:

deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui

deb-src http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui

树莓派更详细的换源可以参考这个博客作者的1楼评论:https://www.cnblogs.com/cheney-970918/p/13781367.html

2.Python的第三方模块安装工具pip换源

新建pip目录

sudo mkdir ~/.pip

切换到pip目录

cd .pip

使用nano编辑器编辑

sudo nano pip.conf

输入

[global]
timeout = 10
index-url =  http://mirrors.aliyun.com/pypi/simple/
extra-index-url= http://pypi.douban.com/simple/
[install]
trusted-host=
    mirrors.aliyun.com
    pypi.douban.com


3.Teamviewer

视频的版本过老,要新版才能用
链接:https://blog.csdn.net/wu693966797/article/details/95936275?utm_medium=distribute.pc_relevant.none-task-blog-baidujs_title-0&spm=1001.2101.3001.4242

总结

完成,准备累死

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值