Raspberry PI (Raspberry PI 4B) system installation

  1. Raspberry Pi Imager.app is a tool for creating images

  2. Download the latest image from the official website using the download tool (Thunderbolt /FDM)

  3. Create an image using Raspberry Pi Imager.app

  4. In the SD card root directory, create an empty SSH file to enable SSH

  5. Connected to cable

  6. IP address Log in to the router to view or use the scan tool

    # Quick IP list for Linux/MAC
    sudo nmap  -sP 192.168.1.0/24
    Copy the code

SSH to raspberry PI

The default user name is PI and the default password is Raspberry
# Set key loginSsh-copy-id pi@Raspberry PI IP address SSH pi@Raspberry PI IP addressCopy the code

Raspberry PI (Raspberry PI 4B) set up the domestic mirror first

Reference # https://developer.aliyun.com/mirror/raspbian
# cut to root
sudo su 

cp /etc/apt/sources.list /etc/apt/sources.list.bak

cat << EOF > /etc/apt/sources.list
deb https://mirrors.aliyun.com/raspbian/raspbian/ buster main non-free contrib
deb-src https://mirrors.aliyun.com/raspbian/raspbian/ buster main non-free contrib
EOF


Copy the code

Docker installation

If the network is abnormal, set the environment variables http_proxy,https_proxy
Install the docker script automatically
curl -sSL https://get.docker.com | sh -x

# Install will take some time

Copy the code

After docker is installed, set the domestic image acceleration of Docker


cat << EOF > /etc/docker/daemon.json
{
  "registry-mirrors": [
    "https://hub-mirror.c.163.com"
  ]
}

EOF

# restart docker
systemctl daemon-reload
systemctl restart docker

# grant docker permission to default PI user
usermod -aG docker pi
Check whether it takes effect
docker info

# under the validation
docker run alpine uname -aLinux 8 e83f539330d 4.19.97 v7l +#1294 SMP Thu Jan 30 13:21:14 GMT 2020 armv7l Linux

Copy the code

Openwrt installation

Enable nic promiscuous mode
ip link set eth0 promisc on
 
# Is in the same network segment as the local network
docker network create -dMacvlan --subnet=192.168.1.0/24 --gateway=192.168.1.1 -o parent=eth0 macnet docker run --restart always --name OpenWRt-d --network macnet --privileged sulinggg/openwrt /sbin/init 

Set the next IP address
docker exec -ti openwrt /bin/bash
# Change the default password
passwd

Change the IP address to an IP address in the network segment
vim /etc/config/network 

/etc/init.d/network restart
Copy the code

After OpenWRT is installed

Open the browser to the IP address you just set and proceed with the subsequent configuration