OrangePi ZERO安装Armbian Linux(Ubuntu Focal)

实验环境:

硬件:OrangePi ZERO LTS 512M

系统: Armbian_21.08.1_Orangepizero_focal_current_5.10.60

结果:安装系统,配置阿里云源,NTP时间同步,安装开发工具,搭建Python3和Nodejs开发环境


  1. 下载必须文件
# 下载系统镜像
https://mirrors.aliyun.com/armbian-releases/
# 下载烧录工具,将img镜像写入到TF卡
http://rufus.ie/zh/

  1. 将SD卡插入读卡器并写入系统,写入完成后,将TF卡插入OrangePi ZERO并上电启动

  1. 使用CP2102 USB转TTL连接OrangePi的调试串口,注意TX与RX交叉

  1. 使用putty打开串口连接,当前串口为COM3,设置波特率115200,停用校验,设置如下:

  1. 成功连接后会输出开机信息
U-Boot SPL 2020.10-armbian (Aug 08 2021 - 16:21:05 +0200)
DRAM: 512 MiB
Trying to boot from MMC1


U-Boot 2020.10-armbian (Aug 08 2021 - 16:21:05 +0200) Allwinner Technology

CPU:   Allwinner H3 (SUN8I 1680)
Model: Xunlong Orange Pi Zero
DRAM:  512 MiB
MMC:   mmc@1c0f000: 0, mmc@1c10000: 1
Loading Environment from FAT... Unable to use mmc 0:1... In:    serial
Out:   serial
Err:   serial
Net:   phy interface0
eth0: ethernet@1c30000
starting USB...
Bus usb@1c1a000: USB EHCI 1.00
Bus usb@1c1a400: USB OHCI 1.0
Bus usb@1c1b000: USB EHCI 1.00
Bus usb@1c1b400: USB OHCI 1.0
Bus usb@1c1c000: USB EHCI 1.00
Bus usb@1c1c400: USB OHCI 1.0
scanning bus usb@1c1a000 for devices... 1 USB Device(s) found
scanning bus usb@1c1a400 for devices... 1 USB Device(s) found
scanning bus usb@1c1b000 for devices... 1 USB Device(s) found
scanning bus usb@1c1b400 for devices... 1 USB Device(s) found
scanning bus usb@1c1c000 for devices... 1 USB Device(s) found
scanning bus usb@1c1c400 for devices... 1 USB Device(s) found
....

orangepizero login: root (automatic login)

  ___  ____  _   _____
 / _ \|  _ \(_) |__  /___ _ __ ___
| | | | |_) | |   / // _ \ '__/ _ \
| |_| |  __/| |  / /|  __/ | | (_) |
 \___/|_|   |_| /____\___|_|  \___/

Welcome to Armbian 21.08.1 Focal with Linux 5.10.60-sunxi

System load:   66%              Up time:       0 min
Memory usage:  19% of 491M      IP:            192.168.60.237
Usage of /:    8% of 15G

[ General system configuration (beta): armbian-config ]

Last login: Thu Aug 26 10:41:40 UTC 2021 on tty1

Waiting for system to finish booting ...

New to Armbian? Documentation: https://docs.armbian.com Support: https://forum.armbian.com
# 第一次启动需要设置root密码,根据提示设置密码后可以正常登录
New root password:
  1. 设置默认源
# 设置ubuntu-ports源(arm)
vi /etc/apt/source.list

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.aliyun.com/ubuntu-ports/ focal main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu-ports/ focal main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu-ports/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu-ports/ focal-updates main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu-ports/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu-ports/ focal-backports main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu-ports/ focal-security main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu-ports/ focal-security main restricted universe multiverse

# 设置armbian镜像
vi /etc/apt/source.list.d/armbian.list
deb https://mirrors.aliyun.com/armbian/ focal main focal-utils focal-desktop

# 更新系统
apt update && apt upgrade -y
  1. 系统设置及NTP时间源
# 设置系统超时等待时间
vi /etc/systemd/system.conf
DefaultTimeoutStartSec=10s
DefaultTimeoutStopSec=10s

# 设置时区
timedatectl set-timezone Asia/Macau
# 设置NTP时间源
vi /etc/chrony/chrony.conf
# 17行,设置阿里云NTP
pool ntp.aliyun.com iburst

# 修改网卡名称
nmcli con mod Wired\ connection\ 1 con-name eth0
  1. 安装Python3.8.10开发环境及Nodejs v16
# 安装工具
apt install python3 python3-dev python3-pip python3-tk python3-venv i2c-tools minicom ntpdate sqlite3 unzip net-tools
# 更新pip
pip3 install -i https://mirrors.aliyun.com/pypi/simple pip -U
# 设置pypi镜像源
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple

# 下载nodejs二进制包
wget https://npmmirror.com/mirrors/node/v16.13.1/node-v16.13.1-linux-armv7l.tar.gz
tar -zxf node-v16.13.1-linux-armv7l.tar.gz
cd node-v16.13.1-linux-armv7l
# 将二进制文件复制到/usr/local/目录
cp -R bin/ lib/ include/ share/ /usr/local/
# 设置NPM镜像源
npm config set registry https://registry.npmmirror.com
  1. 安装SNMP监控
# 安装snmpd服务
apt install snmpd -y
# 修改配置
vi /etc/snmp/snmpd.conf
# 49行,设置允许所有snmp数据
agentaddress  161

# 通过Zabbix服务端添加该主机可进行监控
  1. 备份系统
# 关闭OrangePi并取出TF卡,使用读卡器连接Linux电脑,如果没有电脑没有安装Linux,请使用Vmware安装。
# 查看当前设备
fdisk -l
# 输出
root@ubuntu:~# fdisk -l
Disk /dev/loop0: 55.45 MiB, 58130432 bytes, 113536 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop1: 32.3 MiB, 33865728 bytes, 66144 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop2: 70.32 MiB, 73728000 bytes, 144000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop3: 55.5 MiB, 58183680 bytes, 113640 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop4: 43.28 MiB, 45371392 bytes, 88616 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sda: 64 GiB, 68719476736 bytes, 134217728 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: BD56F15B-BC77-4722-B402-1E2AEF588828

Device       Start       End   Sectors  Size Type
/dev/sda1     2048   1050623   1048576  512M EFI System
/dev/sda2  1050624   3147775   2097152    1G Linux filesystem
/dev/sda3  3147776 134215679 131067904 62.5G Linux filesystem


Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 31.26 GiB, 33554432000 bytes, 65536000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

# 16G TF卡
Disk /dev/sdb: 14.86 GiB, 15931539456 bytes, 31116288 sectors
Disk model: MassStorageClass
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf6fd8d58
# TF卡的分区信息
Device     Boot Start      End  Sectors  Size Id Type
/dev/sdb1        8192 30801919 30793728 14.7G 83 Linux

# 挂载TF卡
root@ubuntu:~# mount /dev/sdb1 /mnt
# 查看分区信息
root@ubuntu:~# ls /mnt
bin   dev  home  lost+found  mnt  proc  run   selinux  sys  usr
boot  etc  lib   media       opt  root  sbin  srv      tmp  var
# 卸载分区
root@ubuntu:~# umount /mnt
# 全盘备份,整个TF卡完整备份并压缩为.gz格式
root@ubuntu:~# dd if=/dev/sdb bs=10M | gzip -c > opizero_20211231.img.gz
1519+1 records in
1519+1 records out
15931539456 bytes (16 GB, 15 GiB) copied, 327.538 s, 48.6 MB/s
# 备份完成后,将镜像发送到Windows主机
root@ubuntu:~# scp opizero_20211231.img.gz [email protected]:d:
[email protected]'s password:
opizero_20211231.img.gz                       100%  712MB  21.8MB/s   00:32

  1. 还原的时候,只需要将gz文件解压出来的img文件通过rufus工具重新写入即可。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章