OrangePi Zero3 折腾记

984 字
5 分钟
OrangePi Zero3 折腾记

前言#

前段时间买了一块香橙派Zero3 2GB版本的开发版,感觉挺适合用来搭建服务器和学习Linux。

另外整了个外壳+小风扇和64G的闪迪红灰卡。

本文记录自己踩过的坑和一些折腾过程,供自用。

官方文档

安装系统#

这里选用的系统是Armbian ,之前试过官方的系统,但是感觉不太好用。

此处下载Armbian系统压缩包,因为我没有桌面需求,所以我下载的是Debian 12的minimal版本,这个版本仅包含一些系统必要包。

使用Etcher烧入工具将系统烧入到TF卡中,将TF卡插入卡槽,连接串口调试线,使用MobaXterm工具进行串口交互(波特率设置为115200)。

设置系统#

初次使用系统会进行初始化设置(设置时区,账号密码等),根据引导设置即可。到最后会让你连接网络,我当时没有插有线网,根据引导连接无线网却直接提示连接失败了,所以只能手动连接。

连接WIFI(可选)#

先查看无线网卡有没有启动,输入 ip link查看所有网络适配器状态,查看wlan0是否为UP状态,如果不是,输入 ip link set wlan0 up启动网卡。

使用 iw dev wlan0 scan | grep "SSID:"扫描附近的网络,并列出SSID。

使用 iw wlan0 connect <SSID>来连接没有密码的网络。

使用 iw wlan0 connect <SSID> keys d:0:<PASSWORD>来连接有WPA加密的网络,其中 <SSID>为网络名,<PASSWORD>为密码。

换源#

由于国外源下载速度太慢,所以还是有必要换成国内源,这里换的是清华源

使用 nano /etc/apt/sources.list命令打开sources.list文件,将里面内容全部使用#注释,并添加以下内容:

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
# deb-src https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware

Debian Buster 以上版本默认支持 HTTPS 源。如果遇到无法拉取 HTTPS 源的情况,请先使用 HTTP 源并安装:

Terminal window
apt install apt-transport-https ca-certificates

使用以下命令更换armbian源:

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

安装一些必要的工具: sudo apt install vim armbian-config

安装Docker#

参考官方文档

使用以下命令添加docker gpg key和apt仓库:

Terminal window
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

安装docker:

Terminal window
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

安装1Panel#

1Panel是一款开源的Linux运维管理面板。

官方安装脚本:

Terminal window
curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && bash quick_start.sh

终端美化#

安装 oh my zsh 美化终端

首先先安装zsh

Terminal window
sudo apt install zsh

然后使用一键脚本安装oh my zsh

Terminal window
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

安装powerlevel10k主题

Terminal window
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"

安装zsh-autosuggestions和zsh-syntax-highlighting插件

Terminal window
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

在.zshrc中启用插件和主题,使用 vim ~/.zshrc打开配置文件,并将下面内容替换掉原本的那一行

plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
ZSH_THEME="powerlevel10k/powerlevel10k"

使用 source ~/.zshrc刷新,使主题和插件生效

关于zsh-syntax-highlighting显示问题#

以普通用户的权限输入 sudo iptables时,iptables被标红,按下回车后却能正常执行。这个问题可能是插件无法识别到iptables的位置,解决方法是将这一行

export PATH="$PATH:/sbin:/usr/sbin"

添加到 .zshrc中,然后使用 source ~/.zshrc刷新

持续更新中…

文章分享

如果这篇文章对你有帮助,欢迎分享给更多人!

OrangePi Zero3 折腾记
https://blog.dotuoodo.top/posts/orangepi-zero3/
作者
DOTUOODO
发布于
2025-02-23
许可协议
CC BY-NC-SA 4.0

评论

Profile Image of the Author
DOTUOODO
Nothing is immortal, but at least we can be extraordinary.
公告
欢迎来到我的博客!目前还在施工中...
分类
标签

文章目录