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工具重新寫入即可。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章