Alpine Linux 原始安装的是 busybox,小巧精干,但毕竟与主流的 Bash 还是有区别,特别是与其它系统联动时会比较麻烦,所以还是安装 Bash,统一 Shell 环境,方便日后使用。
而且基本网上的安装教程都有问题,所以这里给出正确的安装步骤。
$ apk add bash libuser
$ touch /etc/login.defs
$ mkdir /etc/default
$ touch /etc/default/useradd
$ lchsh <root>
Changing shell for root.
Password: <root password>
New Shell [/bin/ash]: /bin/bash
Shell changed.
apt install systemd-timesyncd
# 设置时区
timedatectl set-timezone Asia/Shanghai
# 启动NTP服务
timedatectl set-ntp true
; /etc/systemd/timesyncd.conf
[Time]
NTP=ntp.tuna.tsinghua.edu.cn
FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org
systemctl stop 'postfix@*' ; systemctl disable 'postfix@\x2a' ; apt purge postfix
apt install systemd-networkd systemd-resolved wpa_supplicant
; /etc/wpa_supplicant/wlp2s0.conf
p2p_disabled=1
network={
ssid="<ssid>"
psk="<pwd>"
}
# 测试配置文件
wpa_supplicant -c /etc/wpa_supplicant/wlp2s0.conf -i wlp2s0 -B
# 重启wpa_supplicant服务
systemctl enable wpa_supplicant
systemctl start wpa_supplicant
# 编辑wpa_supplicant服务
systemctl edit wpa_supplicant
### Editing /etc/systemd/system/wpa_supplicant.service.d/override.conf
### Anything between here and the comment below will become the contents of the drop-in file
[Service]
ExecStart=
ExecStart=/usr/sbin/wpa_supplicant -c /etc/wpa_supplicant/wlp2s0.conf -i wlp2s0
Type=simple
Restart=on-failure
RestartSec=5
TimeoutStartSec=180
### Edits below this comment will be discarded
......
systemctl daemon-reload
systemctl restart wpa_supplicant
此处参考/etc/network/interfaces文件里的配置