
Start by creating an instance with Debian or your preferred operating system. Log into the instance.
Download the Arch Linux ISO for booting. Although Alpine’s boot ISO can be used, the process may not be as seamless, but feel free to experiment with it.
wget https://mirrors.cqu.edu.cn/archlinux/iso/latest/archlinux-2022.02.01-x86_64.iso -O /archlinux.iso
Next, download the Alpine Linux minirootfs.
wget https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.15/releases/x86_64/alpine-minirootfs-3.15.0-x86_64.tar.gz -O /alpine.tar.gz
Add the following entry to /boot/grub/grub.cfg after the default Debian session.
menuentry "Archlinux Live (x86_64)" { insmod iso9660 set isofile=/archlinux.iso loopback lo0 ${isofile} linux (lo0)/arch/boot/x86_64/vmlinuz-linux img_dev=/dev/vda1 img_loop=${isofile} earlymodules=loop initrd (lo0)/arch/boot/x86_64/initramfs-linux.img}
Now, access your VNC session via the web page and reboot the instance. Select the newly added entry in the Grub menu.
Once inside the Arch Linux boot disc shell, remount /dev/vda1 in read-write mode, clear everything except the boot disc and Alpine Linux minirootfs, mount /dev/vda1 to /mnt, and then extract the minirootfs. We will retain the boot disc as a fallback option to resolve any issues via the new Grub configuration.
mount -o rw,remount /dev/vda1mv /run/archiso/img_dev/archlinux.iso /tmp/mv /run/archiso/img_dev/alpine.tar.gz /tmp/rm -rf /run/archiso/img_dev/*mount /dev/vda1 /mntmv /tmp/archlinux.iso /mnt/mv /tmp/alpine.tar.gz /mnt/tar -xf /mnt/alpine.tar.gz -C /mnt
Proceed to chroot into the new environment.
mount -t proc /proc /mnt/procmount --rbind --make-rslave /dev /mnt/devmount --rbind --make-rslave /sys /mnt/syscp -L /etc/resolv.conf /mnt/etc/resolv.confchroot /mnt /bin/sh
Configure the Alpine repository.
source /etc/profilecat > /etc/apk/repositories << EOFhttps://mirrors.tuna.tsinghua.edu.cn/alpine/v3.15/mainhttps://mirrors.tuna.tsinghua.edu.cn/alpine/v3.15/communityEOF
Update the package list, upgrade existing packages, and install the base system.
apk updateapk upgradeapk add alpine-base
Install Grub, ensuring to set rootfstype=ext4 in the Linux command line to prevent /dev/vda1 mounting issues.
apk add grub-biosecho 'GRUB_CMDLINE_LINUX="rootfstype=ext4"' >> /etc/default/grub
To avoid unnecessary firmware installations, install linux-firmware-none. We will also install linux-virt.
/boot/grub/grub.cfg is automatically generated, so running grub-mkconfig is unnecessary.
grub-install /dev/vdaapk add linux-firmware-noneapk add linux-virt
Install e2fsprogs for fsck.ext4.
apk add e2fsprogs
Configure fstab.
echo "/dev/vda1 / ext4 defaults 0 1" > /etc/fstab
Set up the network configuration.
cat > /etc/network/interfaces << EOFauto loiface lo inet loopbackauto eth0iface eth0 inet dhcpEOF
Configure OpenRC runlevels.
for i in bootmisc hostname hwclock loadkmap loopback modules networking swap sysctl syslog urandom; doln -s /etc/init.d/$i /etc/runlevels/boot/donefor i in devfs dmesg hwdrivers mdev; doln -s /etc/init.d/$i /etc/runlevels/sysinit/donefor i in acpid sshd; doln -s /etc/init.d/$i /etc/runlevels/default/donefor i in killprocs mount-ro savecache; doln -s /etc/init.d/$i /etc/runlevels/shutdown/done
Finally, reset the root password.
passwd
Reboot the instance to enjoy your freshly installed Alpine Linux.
以上就是Reinstalling Alpine Linux on a Lighthouse Instance的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/25042.html
微信扫一扫
支付宝扫一扫