云服务器安装 AlpineLinux 系统(从网络安装)

各大云厂商提供了种类繁多的系统镜像,但唯独这个小巧可爱的Alpine无人问津。不过也难不倒咱们这些具有折腾精神的极客们。

安装救援系统

本教程支持且不限于阿里云、腾讯云、微软云、谷歌云。如需安装其他版本,替换仓库地址中的edge为所需的版本即可。

1、重置为Debian10系统,通过VNC/Console登录控制台

理论上,重置为 Ubuntu 等使用grub启动器的系统也是可以的(未测试),此选项仅为安装救援系统。

2、安装AlpineLinux救援系统,并设置为从AlpineLinux启动系统

mkdir -p /netboot && cd /netboot

rgeo=`wget -qO- https://ipip.rehi.org/country_code`

if [ "$rgeo" == "CN" ]; then
  repo=https://mirrors.tuna.tsinghua.edu.cn/alpine/edge
else
  repo=https://dl-cdn.alpinelinux.org/alpine/edge
fi

wget $repo/releases/x86_64/netboot/vmlinuz-virt
wget $repo/releases/x86_64/netboot/initramfs-virt
modl=$repo/releases/x86_64/netboot/modloop-virt

cat >> /etc/grub.d/40_custom <<EOF
menuentry "Alpine Linux Minimal" {
    search --set=root --file /netboot/vmlinuz-virt
    linux /netboot/vmlinuz-virt console=tty0 console=ttyS0,115200 ip=dhcp modloop=$modl alpine_repo=$repo/main/
    initrd /netboot/initramfs-virt
}
EOF

sed -i 's/GRUB_DEFAULT=0/GRUB_DEFAULT="Alpine Linux Minimal"/' /etc/default/grub

update-grub
reboot

安装新系统到硬盘

执行alpinelinux的安装脚本,接下来就需要看你自己的啦~

modprobe ext4
setup-alpine

其他安装方法

AlpineLinux 国内镜像

sed -i 's/dl-cdn.alpinelinux.org/mirrors.nju.edu.cn/g' /etc/apk/repositories
文章作者: 若海; 原文链接: https://www.rehiy.com/post/439/; 转载需声明来自技术写真 - 若海

添加新评论