# tech-raspberrypi **Repository Path**: lipinyong/tech-raspberrypi ## Basic Information - **Project Name**: tech-raspberrypi - **Description**: 用于讨论和教学使用树莓派等soc平台开发物联系统 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-03-29 - **Last Updated**: 2024-05-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 初始化树莓派系统 1. 使用Raspberry Imager.exe进行克隆操作 2. 设备选择树莓派3 ![Alt text](image-1.png) ![Alt text](image.png) 3. 操作系统选择Raspberry Pi OS Lite(说明:其他版本的Raspberry Pi OS都可以尝试,本次使用的是32位版本) ![Alt text](image-2.png) 4. 选择对应的tf卡 5. 点击下一步,在弹出的窗口中选择配置设置,如已配过的,则选择是 ![Alt text](image-3.png) 注意:在通用设置里,配置主机名很关键,这能够保证在不知道地址的情况下寻找到这台设备 ![Alt text](image-4.png) 在services配置里开启ssh 所有的都配置好以后,可以开始刻录镜像了 将tf卡插入树莓派后,将笔记本和树莓派都连入同一无线AP,接下来就是等待,大致在2分钟左右。 可以使用ping命令看设备是否连接: ```shell PS C:\Users\A> ping guards-gvsun.local 正在 Ping guards-gvsun.local [fe80::e7b1:842e:a47f:d7d3%14] 具有 32 字节的数据: 来自 fe80::e7b1:842e:a47f:d7d3%14 的回复: 时间=2ms 来自 fe80::e7b1:842e:a47f:d7d3%14 的回复: 时间=1ms 来自 fe80::e7b1:842e:a47f:d7d3%14 的回复: 时间=1ms 来自 fe80::e7b1:842e:a47f:d7d3%14 的回复: 时间=1ms fe80::e7b1:842e:a47f:d7d3%14 的 Ping 统计信息: 数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失), 往返行程的估计时间(以毫秒为单位): 最短 = 1ms,最长 = 2ms,平均 = 1ms ``` ## 登录树莓派 1. 使用ssh工具连入系统,默认的用户名是pi,密码是raspberry ```shell PS C:\Users\A> ssh pi@guards-gvsun.local The authenticity of host 'guards-gvsun.local (fe80::e7b1:842e:a47f:d7d3%14)' can't be established. ED25519 key fingerprint is SHA256:d4lGbpI/PaB33FVWpYJB6N15GUzt0CLW0WgX4tnsdFo. This key is not known by any other names Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added 'guards-gvsun.local' (ED25519) to the list of known hosts. pi@guards-gvsun.local's password: Linux guards-gvsun 6.1.21-v7+ #1642 SMP Mon Apr 3 17:20:52 BST 2023 armv7l The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. SSH is enabled and the default password for the 'pi' user has not been changed. This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password. pi@guards-gvsun:~ $ ``` 2. 设置root密码 ```shell pi@guards-gvsun:~ $ sudo passwd root New password: Retype new password: passwd: password updated successfully ``` 3. 安装所需组件 ```shell pi@guards-gvsun:~ $ sudo bash -c "$(wget -qO- http://192.168.1.139/lipinyong/python2_iot/raw/master/setup.sh)" 配置ssh 更新系统安装git ... ``` 执行完后,需要检查结果: ```shell ## 检查python版本 pi@guards-gvsun:~ $ python Python 2.7.18 (default, Sep 19 2023, 07:10:59) [GCC 10.2.1 20210110] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> exit() ## 检查pip版本 pi@guards-gvsun:~ $ pip --version pip 20.3.4 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7) ``` git clone http://lipinyong:lipinyong@192.168.1.139/lipinyong/python2_iot && mv python2_iot master git clone -b etc http://lipinyong:lipinyong@192.168.1.139/lipinyong/python2_iot && mv python2_iot etc git clone -b gsiot http://lipinyong:lipinyong@192.168.1.139/lipinyong/python2_iot && mv python2_iot gsiot git clone -b setup http://lipinyong:lipinyong@192.168.1.139/lipinyong/python2_iot && mv python2_iot setup git clone -b guard http://lipinyong:lipinyong@192.168.1.139/lipinyong/python2_iot && mv python2_iot guard git clone -b guards http://lipinyong:lipinyong@192.168.1.139/lipinyong/python2_iot && mv python2_iot guards git clone -b resmanage http://lipinyong:lipinyong@192.168.1.139/lipinyong/python2_iot && mv python2_iot resmanage git clone -b tech http://lipinyong:lipinyong@192.168.1.139/lipinyong/python2_iot && mv python2_iot tech git clone -b iotflask http://lipinyong:lipinyong@192.168.1.139/lipinyong/python2_iot && mv python2_iot iotflask git clone -b station http://lipinyong:lipinyong@192.168.1.139/lipinyong/python2_iot && mv python2_iot station git clone -b thirdparty http://lipinyong:lipinyong@192.168.1.139/lipinyong/python2_iot && mv python2_iot thirdparty bash -c "$(wget -qO- http://192.168.1.139/lipinyong/python2_iot/raw/master/setup.sh)"