树莓派3 init
树莓派 3B+ init 记录
Author: Jneeee
Created: March 3, 2023 8:28 PM
Featured: No
Last Updated: March 7, 2023 8:20 PM
Public: Yes
Published: March 3, 2023
Slug: raspberry_pi_3bplus_init
Tags: 折腾, 服务器
我的设备是 pi 3B+
1 安装piOS Lite
- 下载镜像:https://www.raspberrypi.com/software/operating-systems/ ,
https://raspi.debian.net/tested-images/适配的不好 下载TF写入工具,写入镜像:https://www.npackd.org/p/rufus/3.15 (中文,免安装)2022-8-14 11:13:07 官方删除了默认的pi raspberry 密码,需要用官方的 imager 烧录才能改密码设置 wifi 等,参考 https://www.bilibili.com/read/cv16295621 。
先装了个64位的,apt 老是报依赖错误。
刚装好的 piOS Lite 300M大小,装完系统占用才68MB:
pi@pi:~ $ free -h
total used free shared buff/cache available
Mem: 909Mi 55Mi 722Mi 0.0Ki 118Mi 782Mi
Swap: 99Mi 0B 99Mi
2 apt换源
从 RaspbianMirrors - Raspbian 找到阿里的镜像。页面右边有配置说明。
编辑 /etc/apt/sources.list
文件,删除原文件所有内容,用以下内容取代:
deb http://mirrors.aliyun.com/raspbian/raspbian/ bullseye main non-free contrib
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ bullseye main non-free contrib
编辑 /etc/apt/sources.list.d/raspi.list
文件,删除原文件所有内容,用以下内容取代:
deb http://mirrors.aliyun.com/raspberrypi/ bullseye main ui
如果报 GPG key error: NO_PUBKEY xxx, (替换 xxx)
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys xxx
gpg --export --armor xxx | sudo apt-key add -
参考 https://www.cnblogs.com/yutian-blogs/p/13709541.html
3 pip配置
sudo apt install python3-pip
vi .pip/.pip.conf
[global]
trusted-host=mirrors.aliyun.com
index-url=https://mirrors.aliyun.com/pypi/simple/
4 Python 虚拟环境命令
virtualenv py37
virtualenv --python=/usr/local/python-2.7.8/bin/python2.7 py27
source py37/bin/activate
deactivate
5 Git 配置
# ~/.gitconfig
[user]
name = xxx
email = xxx
[core]
editor = vim
autocrlf = true
fileMode = false
[alias]
br = branch
co = checkout
cp = cherry-pick
ss = status
6 安装 nodejs
用 apt 装老是有依赖报错,先跑一下这个 curl 就好了。
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
node --version
7 安装 samba 文件共享
实测下来,从电脑往树莓派无线传输速度有18MB/s 。通过投影仪 kodi 观看 1080P 视频是不卡的。
# 安装
sudo apt-get install samba samba-common-bin
# 配置文件
[public]
comment = public storage
path = /samba
valid users = pi
read only = no
create mask = 0777
directory mask = 0777
guest ok = no
browseable = yes
# 设置 samba 登录的用户(pi)和密码(回车输入)
sudo smbpasswd -a pi
sudo systemctl start smbd
# 文件夹权限
sudo chmod -R 777 /samba
# 之后在 smb:\\ip\public 路径访问即可。