树莓派4B

1. 树莓派资源下载

2. CentOS7安装

2.1  树莓派centos7系统安装配置

2.2 树莓派4安装centos7并配置环境

2.3 CentOS Mirrors List

2.4 CentOS 7 - 安装 unzip

2.5 

Linux-CentOS7虚拟机的网络设置

本例采用dhcp自动分配IP

3. 系统安装

3.1 SD卡格式化

树莓派4B_第1张图片

 3.2 系统烧录

树莓派4B_第2张图片

3.3  

4. docker安装

4.1 从0到1搭建docker环境,顺便安装一下emqx MQTT Broker、HomeAssistant、portainer

4.2 设置docker开机自启动,并设置容器自动重启

5. 实际操作

# 配置自动连接WIFI
[root@192 network-scripts]# vi /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
network={
    ssid="CCMC-zRHe"
    psk="495h4c7b"
    priority=10
}

# 网络设置
[root@192 ~]# cd /etc/sysconfig/network-scripts
[root@192 network-scripts]# ls
ifcfg-CMCC-zRHe  ifdown-eth   ifdown-post    ifdown-Team      ifup-aliases  ifup-ipv6   ifup-post    ifup-Team      init.ipv6-global
ifcfg-lo         ifdown-ippp  ifdown-ppp     ifdown-TeamPort  ifup-bnep     ifup-isdn   ifup-ppp     ifup-TeamPort  keys-CMCC-zRHe
ifdown           ifdown-ipv6  ifdown-routes  ifdown-tunnel    ifup-eth      ifup-plip   ifup-routes  ifup-tunnel    network-functions
ifdown-bnep      ifdown-isdn  ifdown-sit     ifup             ifup-ippp     ifup-plusb  ifup-sit     ifup-wireless  network-functions-ipv6
[root@192 network-scripts]# vi ifcfg-CMCC-zRHe

ESSID=CMCC-zRHe
MODE=Managed
KEY_MGMT=WPA-PSK
SECURITYMODE=open
MAC_ADDRESS_RANDOMIZATION=default
TYPE=Wireless
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPADDR="192.168.1.90"
NETMASK="255.255.255.0"
GATEWAY="192.168.1.1"
DNS1="144.144.144.144"
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=CMCC-zRHe
UUID=2a2ec97a-552f-4dcc-aa4a-0c977d6c2aca
ONBOOT=yes
~   

# 启动emqx
[root@192 ~]# docker images
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
docker.io/emqx/emqx     4.3.10              4ad27d487b4f        13 months ago       134 MB
docker.io/hello-world   latest              c0218de6585d        14 months ago       8.95 kB
[root@192 ~]# docker run -d --name emqx -p 18083:18083 -p 1883:1883 emqx/emqx:4.3.10
0ba0af4820acdd3da4c9ff8cfb4a1867a88c1e5cb559775ff096a93c9547866d
[root@192 ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                                                                                                                    NAMES
0ba0af4820ac        emqx/emqx:4.3.10    "/usr/bin/docker-e..."   5 seconds ago       Up 3 seconds        4369-4370/tcp, 5369/tcp, 6369-6370/tcp, 8081/tcp, 8083-8084/tcp, 8883/tcp, 0.0.0.0:1883->1883/tcp, 0.0.0.0:18083->18083/tcp, 11883/tcp   emqx
     
# 查看已启动的服务
[root@192 network-scripts]# systemctl list-unit-files | grep enable
auditd.service                                                          enabled 
[email protected]                                                         enabled 
chronyd.service                                                         enabled 
crond.service                                                           enabled 
dbus-org.fedoraproject.FirewallD1.service                               enabled 
dbus-org.freedesktop.nm-dispatcher.service                              enabled 
docker.service                                                          enabled 
firewalld.service                                                       enabled 
[email protected]                                                          enabled 
irqbalance.service                                                      enabled 
kdump.service                                                           enabled 
lvm2-monitor.service                                                    enabled 
NetworkManager-dispatcher.service                                       enabled 
NetworkManager-wait-online.service                                      enabled 
NetworkManager.service                                                  enabled 
postfix.service                                                         enabled 
rhel-autorelabel-mark.service                                           enabled 
rhel-autorelabel.service                                                enabled 
rhel-configure.service                                                  enabled 
rhel-dmesg.service                                                      enabled 
rhel-domainname.service                                                 enabled 
rhel-import-state.service                                               enabled 
rhel-loadmodules.service                                                enabled 
rhel-readonly.service                                                   enabled 
rhsmcertd.service                                                       enabled 
rsyslog.service                                                         enabled 
sshd.service                                                            enabled 
systemd-readahead-collect.service                                       enabled 
systemd-readahead-drop.service                                          enabled 
systemd-readahead-replay.service                                        enabled 
tuned.service                                                           enabled 
dm-event.socket                                                         enabled 
lvm2-lvmetad.socket                                                     enabled 
lvm2-lvmpolld.socket                                                    enabled 
default.target                                                          enabled 
graphical.target                                                        enabled 
remote-fs.target                                                        enabled 
runlevel5.target                                                        enabled   

# docker容器设置自动启动
[root@192 network-scripts]# docker update --restart=always emqx
emqx
        

你可能感兴趣的:(物联网,学习)