树莓派配置

初始化

1
2
3
4
5
6
7
# 设置时区
/timedatectl set-timezone Asia/Shanghai
# root 登入 
# 建议使用ssh-key, 关闭root登入
sudo passwd root
sudo sh -c 'echo "PermitRootLogin yes" >> /etc/ssh/sshd_config'
/etc/init.d/ssh restart

软件安装

使用清华源镜像

1
2
3
4
5
6
# 编辑 `/etc/apt/sources.list` 文件,删除原文件所有内容,用以下内容取代:
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib rpi

# 编辑 `/etc/apt/sources.list.d/raspi.list` 文件,删除原文件所有内容,用以下内容取代:
deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui

安装常用工具

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

# shell 
sudo apt install zsh
chsh -s /usr/bin/zsh

# application
sudo apt install realvnc-vnc-server 
sudo raspi-config
#neovim
sudo apt install snapd
sudo snap install --classic nvim
# locale
sudo apt install locales-all
# docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo pip3 install docker-compose
sudo usermod -aG docker $USER

# service
sudo apt install  samba
sudo smbpasswd -a pi
sudo service smbd start

neovim

树莓派上安装:

1
sudo snap install --classic nvim

若无 sudo 权限,可选择nvim.appimage

安装 ctags

1
2
3
4
5
git clone https://github.com/universal-ctags/ctags.git
cd ctags
./autogen.sh
./configure --prefix=$HOME/.local/ # defaults to /usr/local
make && make install

磁盘管理

磁盘分区

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
sudo parted -a optimal /dev/sda [ENTER]
parted>> mklabel gpt 
parted>> mkpart primary [ext4] 0% 1TB
parted>> align-check optimal 1
parted>> name 1 test_name
parted>> rm 1 # remove partition
parted>> print
parted >> quit
sudo mkfs.ext4 /dev/sda1
# label disk
sudo e2label /dev/sda1 SeaPlus

# 查看磁盘情况
$ fdisk -l
$ fdisk /dev/sda

磁盘状态

1
2
3
4
5
6
7
sudo blkid
sudo parted -l
sudo fdisk -l  # 查看分区
sudo lsblk -o PATH,SIZE,RO,TYPE,MOUNTPOINT,UUID,MODEL
hwinfo
ls -l /dev/disk/by-label
df -h # 磁盘空间状态

自动挂载

1
2
3
4
# Add line to /etc/fstab 
LABEL=SeaPlus /mnt/seaplus ext4 defaultssu 0 2
#mount manually
sudo mount -a

Samba

1
2
3
4
5
6
7
8
[infuse]
comment = infuse
path = "/home/pi/infuse"
writeable = yes
guest ok = no
create mask = 0777
directory mask = 0777
valid user = pi
updatedupdated2023-06-052023-06-05
Update https-ca.md