首页 > 运维 > linux运维 > 正文

Reinstalling Alpine Linux on a Lighthouse Instance

看不見的法師
发布: 2025-07-14 09:40:02
原创
997人浏览过

reinstalling alpine linux on a lighthouse instance

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/vda1
mv /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 /mnt
mv /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/proc
mount --rbind --make-rslave /dev /mnt/dev
mount --rbind --make-rslave /sys /mnt/sys
cp -L /etc/resolv.conf /mnt/etc/resolv.conf
chroot /mnt /bin/sh
登录后复制

Configure the Alpine repository.

source /etc/profile
cat > /etc/apk/repositories << EOF
https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.15/main
https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.15/community
EOF
登录后复制

Update the package list, upgrade existing packages, and install the base system.

apk update
apk upgrade
apk add alpine-base
登录后复制

Install Grub, ensuring to set rootfstype=ext4 in the Linux command line to prevent /dev/vda1 mounting issues.

jQuery瀑布流插件Grid-A-Licious
jQuery瀑布流插件Grid-A-Licious

jQuery瀑布流插件Grid-A-Licious是一款简单易用的jQuery插件,可用于创建响应式瀑布流布局,针对不同设备可自动适应宽度。

jQuery瀑布流插件Grid-A-Licious81
查看详情 jQuery瀑布流插件Grid-A-Licious
apk add grub-bios
echo '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/vda
apk add linux-firmware-none
apk 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 << EOF
auto lo
iface lo inet loopback
<p>auto eth0
iface eth0 inet dhcp
EOF
登录后复制

Configure OpenRC runlevels.

for i in bootmisc hostname hwclock loadkmap loopback modules networking swap sysctl syslog urandom; do
ln -s /etc/init.d/$i /etc/runlevels/boot/
done
for i in devfs dmesg hwdrivers mdev; do
ln -s /etc/init.d/$i /etc/runlevels/sysinit/
done
for i in acpid sshd; do
ln -s /etc/init.d/$i /etc/runlevels/default/
done
for i in killprocs mount-ro savecache; do
ln -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的详细内容,更多请关注php中文网其它相关文章!

最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号