Untitled post
Openwrt install docker
Install Openwrt system into Raspberry Pi.
Choose image base model version, and get the image file:
https://openwrt.org/toh/raspberry_pi_foundation/raspberry_pi
Flash the image file into U disk or SD Card
diskutil list
diskutil umountDisk diskX
sudo dd if=/path/to/downloaded/disk.img of=/dev/diskX bs=1m
Refer to:
https://apple.stackexchange.com/questions/323814/how-to-flash-img-on-mac-for-raspberry-pi
Insert SD Card into Raspberry Pi, boot it.
Access 192.168.1.1 , set a password. Change the Port type to "LAN", and enable it's DHCP.
Line the Raspberry Pi to your Router, from now, we can access the Raspberry Pi with SSH.
在“网络”-“接口”的“常规设置”中给 Openwrt 的 LAN 网络接口设置一个和现有局域网同网段的静态 IP 地址,注意不要和现有设备的 IP 地址冲突。然后应用设置。
将 LAN 网络接口的“默认网关”设为主路由的 IP 地址。
在“高级设置”中找到“使用自定义的 DNS 服务器”设为主路由的 IP 地址。
在“DHCP 服务器”中勾选“忽略此接口”。
在“DHCP 服务器”-“IPv6 设置”中禁用所有IPv6服务。
点击“保存”以及“保存并应用”。
在“网络”-“防火墙”中,关闭“SYN-flood 防御”,点击“保存并应用”。
建议重启一次。
更换 opkg 软件源
/etc/opkg/distfeeds.conf
将其中的 http://downloads.openwrt.org
替换为
https://mirrors.tuna.tsinghua.edu.cn/openwrt
Extend disk
Remote control your Raspberry Pi with ssh
We need a mount point in the tab to generate "/etc/config/fstab"
First we need install "block-mount", then reboot.
opkg install block-mount lsblk cfdisk terminfo
Then, reboot.
cfdisk /dev/mmcblk0
If openwrt don't have cmd lsblk and cfdisk, using opkg install it.
If the cfdisk cmd hits come issue, solve it with install "terminfo"
root@OpenWrt:~# cfdisk /dev/mmcblk0
Error opening terminal: xterm-256color.
root@OpenWrt:~# export TERM=xterm
root@OpenWrt:~# cfdisk /dev/mmcblk0
Error opening terminal: xterm.
root@OpenWrt:~# opkg install terminfo
Format the new disk.
root@OpenWrt:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
mmcblk0 179:0 0 119.4G 0 disk
├─mmcblk0p1 179:1 0 68M 0 part /boot
├─mmcblk0p2 179:2 0 10G 0 part /
├─mmcblk0p3 179:3 0 1K 0 part
├─mmcblk0p5 179:5 0 10G 0 part
└─mmcblk0p6 179:6 0 99.3G 0 part
root@OpenWrt:~# mkfs.ext4 /dev/mmcblk0p5
挂载硬盘
root@OpenWrt:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
mmcblk0 179:0 0 119.4G 0 disk
├─mmcblk0p1 179:1 0 64M 0 part /boot
├─mmcblk0p2 179:2 0 10G 0 part /
├─mmcblk0p3 179:3 0 1K 0 part
├─mmcblk0p5 179:5 0 10G 0 part /overlay
└─mmcblk0p6 179:6 0 99.3G 0 part /mnt/mmcblk06
In the mount-points, find and execute the "Generate Config".
After mounting, change "/etc/config/fstab" mount point's enabled to 1. So that the mount will keep after rebooting.
We can also follow raspberry Pi official instructions:
The /overlay needs larger disk to install docker.
So that we can mount mmcblk0p5 to /overlay directly.
root@OpenWrt:~# mount /dev/mmcblk0p5 /overlay
Install Docker
opkg install docker dockerd luci-app-dockerman
Following home-assistant information to use docker compose to load Home-assistant image.
https://www.home-assistant.io/installation/alternative
Install Luci theme Argon
https://github.com/jerrykuku/luci-theme-argon
Install open_clash
opkg install bash iptables dnsmasq-full curl ca-bundle ipset ip-full iptables-mod-tproxy iptables-mod-extra ruby ruby-yaml kmod-tun kmod-inet-diag unzip luci-compat luci luci-base
opkg remove dnsmasq