vault backup: 2022-09-28 19:13:41

Affected files:
.obsidian/workspace
03. Programming/COM/20210726 - COM Interface.md
03. Programming/DB/MySQL.md
03. Programming/DB/sqlite.md
03. Programming/Design Pattern.md
03. Programming/FFMPEG/00. Introduction.md
03. Programming/FFMPEG/01. Setup.md
03. Programming/FFMPEG/FFMpeg.md
03. Programming/Flask.md
03. Programming/Media Foundation/20210604 - Windows media foundation.md
03. Programming/OpenCV.md
03. Programming/OpenGL.md
03. Programming/Python/argparse.ArgumentParser.md
03. Programming/Python/decorator.md
03. Programming/Python/logging.md
03. Programming/Python/opencv.md
03. Programming/Python/subprocess.md
03. Programming/Python/threading.md
03. Programming/Python/tkinter.md
03. Programming/Python/檢測工具.md
03. Programming/QT/Dropdown button.md
03. Programming/QT/QVariant.md
03. Programming/QT/Qt.md
03. Programming/UML.md
03. Programming/演算法.md
04. 資料收集/99. templates/blogHeader.md
04. 資料收集/99. templates/date.md
04. 資料收集/99. templates/front matter.md
04. 資料收集/99. templates/note.md
04. 資料收集/99. templates/table.md
04. 資料收集/99. templates/thisWeek.md
04. 資料收集/99. templates/日記.md
04. 資料收集/99. templates/讀書筆記.md
04. 資料收集/Linux/CLI/cut.md
04. 資料收集/Linux/CLI/scp.md
04. 資料收集/Linux/CLI/timedatectl.md
04. 資料收集/Linux/Programming.md
04. 資料收集/Linux/Ubuntu.md
04. 資料收集/Tool Setup/Hardware/RaspberryPi.md
04. 資料收集/Tool Setup/Software/Chrome.md
04. 資料收集/Tool Setup/Software/Obisidian.md
04. 資料收集/Tool Setup/Software/SublimeText.md
04. 資料收集/Tool Setup/Software/VirtualBox.md
04. 資料收集/Tool Setup/Software/Visual Studio Code.md
04. 資料收集/Tool Setup/Software/Windows Setup.md
04. 資料收集/Tool Setup/Software/Windows Terminal.md
04. 資料收集/Tool Setup/Software/freefilesync.md
04. 資料收集/Tool Setup/Software/vim.md
04. 資料收集/名言佳句.md
04. 資料收集/架站/Gitea.md
04. 資料收集/架站/HTTP Server/Apache.md
04. 資料收集/架站/HTTP Server/Nginx/Reverse Proxy(Layer4).md
04. 資料收集/架站/Pelican blog.md
04. 資料收集/架站/Proxmox VE.md
04. 資料收集/架站/SWAG Reverse proxy.md
04. 資料收集/架站/Storj.md
04. 資料收集/架站/Trojan.md
04. 資料收集/每週外食.md
04. 資料收集/科技/802.11.md
04. 資料收集/科技/HDR Sensor.md
04. 資料收集/科技/量子電腦.md
04. 資料收集/科技/鋰電池.md
04. 資料收集/興趣嗜好/RC/Traxxas Sledge.md
04. 資料收集/興趣嗜好/RC/好盈電變調整中立點.md
04. 資料收集/興趣嗜好/RC/差速器調教教學.md
04. 資料收集/興趣嗜好/模型/舊化作例.md
04. 資料收集/興趣嗜好/軍武/虎式.md
04. 資料收集/讀書筆記/20201201 - 學習如何學習.md
04. 資料收集/讀書筆記/20201218 - Kotlin權威2.0.md
04. 資料收集/讀書筆記/20201224 - 寫作是最好的自我投資.md
04. 資料收集/讀書筆記/20210119 - 中產悲歌.md
04. 資料收集/讀書筆記/20210220 - 最高學習法.md
04. 資料收集/讀書筆記/20210320 - 最高學以致用法.md
04. 資料收集/讀書筆記/20210406 - 精準購買.md
04. 資料收集/讀書筆記/20210723 - 高手學習.md
04. 資料收集/讀書筆記/20220526 - 深入淺出設計模式.md
04. 資料收集/讀書筆記/20220619 - 精確的力量.md
04. 資料收集/軟體工具/IPFS.md
04. 資料收集/軟體工具/MkDocs.md
04. 資料收集/軟體工具/Obsidian.md
04. 資料收集/軟體工具/docker.md
04. 資料收集/軟體工具/git/apply.md
04. 資料收集/軟體工具/git/submodule.md
04. 資料收集/軟體工具/youtube-dl.md
04. 資料收集/面試準備/技术面试最后反问面试官的话.md
This commit is contained in:
2022-09-28 19:13:41 +08:00
parent 0534f846d1
commit c847c7f07d
85 changed files with 7 additions and 7 deletions

View File

@@ -0,0 +1,134 @@
### 登入
- 帳號:`pi`
- 密碼:`<你自己設的密碼>`
### 設定固定IP
#### Ethernet
打開`/etc/dhcpcd.conf`,設定如下:
```
interface eth0
static ip_address=192.168.1.20/24
static routers=192.168.1.1
static domain_name_servers=168.95.1.1 1.1.1.1
```
#### WIFI
打開`/etc/dhcpcd.conf`,設定如下:
```
interface wlan0
static ip_address=192.168.1.21/24
static routers=192.168.1.1
static domain_name_servers=168.95.1.1 1.1.1.1
```
確定`dhcpcd``networking`是enabled不確定可以直接用下面的命令來啟動。
```shell
systemctl enable dhcpcd ;\
systemctl enable networking
```
### 更新記憶卡容量
- [Taiwan-RaspberryPi | 台灣樹莓派 - (1)更新記憶卡容量](https://www.taiwan-raspberrypi.com/start/setting/1%E6%9B%B4%E6%96%B0%E8%A8%98%E6%86%B6%E5%8D%A1%E5%AE%B9%E9%87%8F/)
### 設定免密碼登入
1. 將自己的public key copy到RaspberryPi上
```
scp ~/.ssh/rpi.pub pi@<IP_ADDR>:~/.ssh/
```
2. 登入到RaspberryPi這一次要輸入密碼
```shell
ssh pi@<IP_ADDR>
```
3. 現在是在RaspberryPi上操作把剛剛的public key加到`authorized_keys`裡面:
```bash
cd ~/.ssh ;\
cat id_rsa.pub >> authorized_keys
```
## 安裝
### Python3
```shell
sudo apt install python3
```
### Docker
#### Install
```shell
# Install some required packages first
sudo apt update ; sudo apt install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
# Get the Docker signing key for packages
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -
# Add the Docker official repos
echo "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list
# Install Docker
sudo apt update ; sudo apt install -y --no-install-recommends docker-ce cgroupfs-mount
```
#### Confirm installation
```shell
sudo docker run --rm hello-world
```
如果成功,會有如下的訊息:
![[Pasted image 20210125183754.png]]
### docker-compose
```shell
# Install required packages
sudo apt update ; sudo apt install -y python3-pip libffi-dev
# Install Docker Compose from pip (using Python3)
# This might take a while
sudo pip3 install docker-compose
```
#### Confirm installation
```shell
docker-compose -version
```
會輸出docker-compose的版本類似下面
```
docker-compose version 1.28.0, build unknown
```
## 更新
```shell
sudo apt-get update `# 1. 更新 /etc/apt/sources.list 底下的套件清單。` ;\
sudo apt-get upgrade `# 2. 比對套件清單決定是否需要更新,但如果要更新的套件有相依性問題,則放棄更新。` ;\
sudo apt-get dist-upgrade `# 3. 會處理新版本套件與相依性套件的衝突,並試著安裝/移除有問題的套件來完成更新。` ;\
sudo apt-get autoremove `# 4. 刪除之前因為有相依性而安裝,但現在已經不再使用的套件(非必要)。` ;\
sudo apt-get autoclean `# 5. 清除下載到 /var/cache/apt/archives 的 .deb 套件檔(非必要)` ;\
sudo rpi-update `# 6. 更新核心和韌體到最新版本(可能不穩定),因此更新前一定要先備份重要資料`
```
## 備份
1. 下載必須的工具
```
wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh
sudo chmod +x pishrink.sh
sudo mv pishrink.sh /usr/local/bin
```
1. 插入隨身碟並將隨身碟mount起來。記住mount的路徑這邊假設是`/mnt/usb0`。
2. 用`lsblk`確認SD卡的device node這邊假設SD卡是`/dev/mmcblk0`。
3. 輸入以下指令將整片microSD卡備份到USB隨身碟
```
sudo dd if=/dev/mmcblk0 of=/mnt/usb0/PiBackup_20220513.img bs=1M
```
這個命令會將整張SD卡dummp到隨身碟SD卡有多大產生的img檔就會有多大。
這個命令會花上好一點時間。
> `dd`命令並不會顯示任何進度或是訊息,若是希望在執行過程中看到一些訊息,可以加入`status=progress`,將可以看到速度的訊息。
> 但是`progress`這個小工具是需要另外安裝的,可以用`sudo apt install progress`來安裝。
> 例:`sudo dd if=/dev/mmcblk0 of=/mnt/usb0/PiBackup_20220513.img bs=1M status=progress`
5. 切換到隨身碟的目錄:`cd /mnt/usb0`。
6. 用以下命令來把img變小
```
sudo pishrink.sh -z PiBackup_20220513.img
```
這個命令也會花上好一點時間。
### 參考
- [[Raspberry Pi] 備份樹莓派系統Micro SD卡的最佳做法_PiShrink @ skybow](https://skybow.pixnet.net/blog/post/121176894-%5Braspberry-pi%5D-%E5%82%99%E4%BB%BD%E6%A8%B9%E8%8E%93%E6%B4%BEsd%E5%8D%A1%E7%9A%84%E6%9C%80%E4%BD%B3%E5%81%9A%E6%B3%95)