香橙派安装Armbian并配置国内软件源、SSH和静态IP

以Orange Pi Zero 全志H2为例,官方Debian镜像下载地址:

http://www.orangepi.cn/html/hardWare/computerAndMicrocontrollers/service-and-support/Orange-Pi-Zero.html

该下载页面提供的Debian下载地址是百度网盘分享链接,版本为Debian 10。推荐在Armbian官网下载,Armbian官网目前提供了Debian 12 (Bookworm)和Debian 13 (Trixie):

https://www.armbian.com/orange-pi-zero/

烧写系统镜像

Windows平台可以使用balenaEtcher-Portable将镜像写入TF卡,参考香橙派安装、备份Debian系统教程

Ubuntu平台使用dd命令烧写,以下命令解压并将img写入TF卡:

xzcat Armbian_25.5.1_Orangepizero_bookworm_current_6.12.23_minimal.img.xz | sudo dd of=/dev/sdX bs=1M status=progress oflag=dsync

将命令中的镜像路径和设备名称(不带分区号)替换后再执行。查看设备名称:

lsblk

如果TF卡之前已经有分区,并且自动挂载到了电脑,需要先卸载再烧写。

sudo umount /dev/sdX1

也可以先解压再写入:

xz -d Armbian_25.5.1_Orangepizero_bookworm_current_6.12.23_minimal.img.xz

sudo dd if=Armbian_25.5.1_Orangepizero_bookworm_current_6.12.23_minimal.img of=/dev/sdX bs=1M status=progress oflag=dsync

烧写完成会发现TF卡的名称变成了armbian_boot,查看分区只有镜像大小,启动系统后会自动扩展分区。

配置Armbian

香橙派插入网线并开机,在路由器管理中找到对应IP,使用SSH登录:

ssh root@ip

默认密码是:1234 登录后系统会自动进入配置流程。

Welcome to Armbian! 
Documentation: https://docs.armbian.com | Community support: https://forum.armbian.com
IP address: 192.168.1.8
Create root password: 

该步骤是设置root密码。输入密码后还需要重复输入一次:

Repeat root password:

创建普通用户:

Support status: community support (looking for a dedicated maintainer)
Creating a new user account. Press  to abort
Please provide a username (eg. your first name): orangepi

设置普通用户密码:

Create user (orangepi) password:
Repeat user (orangepi) password: 

输入你的名称,系统会自动根据用户名生成首字母大写的名称:

Please provide your real name: Orangepi

接下来系统会设置语言环境:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = "en_US.UTF-8",
	LC_ALL = (unset),
	LC_ADDRESS = "zh_CN.UTF-8",
	LC_NAME = "zh_CN.UTF-8",
	LC_MONETARY = "zh_CN.UTF-8",
	LC_PAPER = "zh_CN.UTF-8",
	LC_IDENTIFICATION = "zh_CN.UTF-8",
	LC_TELEPHONE = "zh_CN.UTF-8",
	LC_MESSAGES = "en_US.UTF-8",
	LC_MEASUREMENT = "zh_CN.UTF-8",
	LC_TIME = "zh_CN.UTF-8",
	LC_NUMERIC = "zh_CN.UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").

提示用户已创建,并添加到了sudo组:

Dear Orangepi, your account orangepi has been created and is sudo enabled.
Please use this account for your daily work from now on.

设置时区:

Detected timezone: Asia/Shanghai
Set user language based on your location? [Y/n] y

选择语言:

At your location, more locales are possible:

1) bo_CN		    3) zh_CN.UTF-8
2) ug_CN		    4) Skip generating locales
Please enter your choice: 3

配置完成后推荐使用普通用户orangepi登录。

设置国内软件源

备份sources.list并替换源地址为清华镜像源:

sudo sed -i.bak 's|http://deb.debian.org|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/debian.sources

备份armbian.sources并替换源地址为清华镜像源:

sudo sed -i.bak 's|http://apt.armbian.com|https://mirrors.tuna.tsinghua.edu.cn/armbian|g' /etc/apt/sources.list.d/armbian.sources

刷新本地软件包列表索引:

sudo apt update

配置SSH只允许普通用户使用密钥登录

在本地电脑生成密钥对:

ssh-keygen -t rsa

得到公钥id_rsa.pub和私钥id_rsa文件,将公钥复制到香橙派的authorized_keys文件:

ssh-copy-id -i ~/.ssh/id_rsa.pub orangepi@192.168.1.8

登录香橙派,编辑SSH配置文件:

sudo nano /etc/ssh/sshd_config

确保以下行已取消注释,开启公钥验证:

PubkeyAuthentication yes

重启SSH服务:

sudo systemctl restart sshd

测试使用密钥登录正常再禁用密码登录:

PasswordAuthentication yes

禁用root用户登录:

PermitRootLogin no

重启SSH服务:

sudo systemctl restart sshd

配置静态IP

Armbian配置静态IP很简单,可以使用Armbian提供的配置工具:

armbian-config

选择Network – Fixed and wireless network settings (end0):

香橙派安装Armbian并配置国内软件源、SSH和静态IP

选择BNS001 – Basic network setup:

香橙派安装Armbian并配置国内软件源、SSH和静态IP

选择要修改的网卡:

香橙派安装Armbian并配置国内软件源、SSH和静态IP

选择Configure:

armbian-config-network_4

选择Static Set IP manually:

armbian-config-network_5

Mac地址默认的即可,到IP配置这一步,设置需要的IP即可:

armbian-config-network_6

后续的配置项一路回车即可。对应配置文件路径:

/etc/netplan/armbian.yaml

原创文章,作者:,如若转载,请注明出处:https://ce.771633.xyz/4470.html

Like (0)
Previous 2025年10月25日
Next 2025年12月8日

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注