Raspberry Pi OS 64bit Lite (Raspbian Buster Lite)のセットアップ

Raspberry Pi 4 Model B
今回は3Dプリンタで印刷したフレームにRaspberry Pi, 2.5インチ SSD, 6010 ファンを搭載したこいつがターゲット。
USB bootのためのbootloaderの更新は済ませてある。
性能的にはddでの計測で読み書き200MB/s前後、openssl speed -multi 4を回しても60℃未満という感じ。

準備

  1. 64bit版のイメージをダウンロードする Index of /raspios_lite_arm64/images
  2. balenaEtcherでSSDにイメージを焼き、/boot/sshを作る
  3. 電源を繋ぎしばし待つ

メモ

ssh pi@raspberrypi.localraspberryで接続する。
ssh-keygen -t ed25519して~/.ssh/id_ed25519.pubGitHubに登録しておく。
sshdの設定が不安ならssh -v -o PubkeyAuthentication=no pi@raspberrypi.localで試せる。

初期設定

passwd
sudo apt update && sudo apt upgrade

echo "NTP=ntp.nict.jp" | sudo tee -a /etc/systemd/timesyncd.conf

curl -s https://github.com/ebith.keys | tee -a ~/.ssh/authorized_keys

sudo tee -a /etc/ssh/sshd_config << EOM > /dev/null
PasswordAuthentication no
PermitRootLogin no
Port 22
EOM

sudo tee -a /etc/dhcpcd.conf << EOM > /dev/null
interface eth0
static ip_address=192.168.0.81/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1 1.1.1.1 8.8.8.8
EOM

sudo hostnamectl set-hostname raspberrypi4b
sudo timedatectl set-timezone Asia/Tokyo
sudo dpkg-reconfigure locales

環境整備

ARMで64bitの環境で今どきのツールなどを使おうとすると概ねバイナリの配布がない。
そもそもDebian系はパッケージがあってもリポジトリは無いということも多く面倒。

sudo apt install git tmux vim
sudo update-alternatives --config editor

公式に従って入れるやつ

自前ビルドのやつ

Rust

curl https://sh.rustup.rs -sSf | sh
source .cargo/env

ghq get starship/starship
cd ghq/github.com/starship/starship/
sed -i -e '/^\[dependencies\]$/a openssl = { version = "0.10.30", features = ["vendored"] }' Cargo.toml
cargo build --release
cp target/release/starship ~/.cargo/bin/

ghq get dandavison/delta
cd ghq/github.com/dandavison/delta
cargo build --release
cp target/release/delta ~/.cargo/bin/

cargo install ripgrep
cargo install bat
cargo install lsd
cargo install fd-find

Go

echo "deb http://deb.debian.org/debian buster-backports main contrib non-free" | sudo tee /etc/apt/sources.list.d/buster-backports.list
sudo apt -t buster-backports install golang
export GOPATH=$HOME/.go
export PATH=$GOPATH/bin:$PATH

go get -u github.com/junegunn/fzf
go get -u github.com/x-motemen/ghq

dotfiles

ghq get ebith/dotfiles
cd ghq/github.com/ebith/dotfiles
./create_link.py .config .vim .gitconfig .tmux.conf .yarnrc
mkdir -p ~/.vimlocal/{backup,swap,undo}
chsh -s /usr/bin/fish
sudo systemctl reboot
rm .bash* .profile
fisher

このあと

  • VPSで動かしているのをこっちに移して解約する
  • UPSは無いので停電の際はあきらめる