All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Guide: Install a new OS (AlmaLinux 9) on a VPS that can't mount custom ISO's
Like a lot of you, I've been holding out with CentOS 7 for many years on my VPS. VirMach recently migrated VPS's to higher performance servers and CentOS 9 & derivatives were just coming out, and so I decided what better time to finally upgrade. Since custom ISO mounts weren't available, and there were no re-install templates for it, I had to make a request ticket. After waiting.. a little while.. on VirMach to respond to my own measly ticket among the flood of tickets they've been receiving, I decided to take matters into my own hands. The past 12 hours contained a lot of blood, sweat, and tears, but I was finally able to install AlmaLinux 9 on my own - quite a feat, given my skills. I made a (hopefully fool-proof) guide so you can do it yourself without all that. Let me know if there's any issues that aren't super specific to your setup and I'll see if it's something I can add/fix. Credit to AndersonIncorp on GitHub, for providing the starting point for my guide and 'adventure'.
Install OS (RHEL 9/CentOS 9/AlmaLinux 9/Rocky Linux 9/other) on a VPS without the ability to mount custom ISO's
Note: As far as I know, the only way to complete some of these steps (booting into grub options & using Tiny Core Linux) is using a VNC connection to your server (typically provided by your server host) or some alternative that allows you to view the system as it's booting up.
Recommended starting OS is CentOS 7/8 or derivative.
Install Tiny Core Linux into grub
wget https://distro.ibiblio.org/tinycorelinux/9.x/x86_64/release/CorePure64-9.0.iso -O /boot/CorePure64-9.0.iso
nano /etc/grub.d/40_custom
# make sure to choose the correct disk below (containing /boot)
# (hd0,msdos1) [AKA vda1 or sda1] is likely your default
# /etc/grub.d/40_custom #
menuentry "CorePure64-9.0.iso" {
loopback loop (hd0,msdos1)/boot/CorePure64-9.0.iso
linux (loop)/boot/vmlinuz64
initrd (loop)/boot/corepure64.gz
}
#########################
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot
Manage partitions and copy ISO
Set up static IP network in Tiny Core Linux
sudo su
pkill udhcpc
ifconfig eth0 123.123.123.123 netmask 255.255.255.0 # public IPv4
route add default gw 123.123.123.1 eth0 # gateway IP
echo "nameserver 8.8.8.8" > /etc/resolv.conf
ifconfig eth0 up
ping -c 4 google.com
Install e2fsprogs (resize2fs), util-linux (fdisk, sfdisk, cfdisk), openssl (https for wget)
exit # log out of root first
tce-load -wi e2fsprogs
tce-load -wi util-linux
tce-load -wi openssl
Mount /boot partition and save partition table inside
sudo su
fdisk -l
mount /dev/vda1 /mnt
sfdisk -d /dev/vda > /mnt/part_table # restore with `sfdisk /dev/vda < /mnt/part_table`
umount /mnt
Partition disk:
Goal is to reduce the size of a current partition (~1-8GB, depending on your ISO) if necessary, create a new partition, and copy your ISO into it.
It's very important to understand what you're doing with fdisk and partitioning here - read up on it in the link below. Commands you're likely to need: p (list partitions), d (delete partition), n (new partition).
If you encounter an error when booting into your old/primary OS later on, it's likely due to a mistake made here. Worst case, you can use the re-install option in your VPS's client area and start over from the beginning.
https://access.redhat.com/articles/1190213
fdisk -l /dev/vda
# only required if you need to reduce an existing partition first #
e2fsck -f /dev/vda1
resize2fs /dev/vda1 40G # size to reduce partition to (units: K, M, G, S [sectors])
###################################################################
fdisk /dev/vda
# use commands (p, d, n) from above link here.
# if asked to 'Remove ext4 signature', [N]o
# note that further steps assume you choose partition number 2 for the new partition
Copy ISO to new partition using pipe from wget
# check if URL is valid
wget -S --spider https://distro.ibiblio.org/almalinux/9.0/isos/x86_64/AlmaLinux-9.0-x86_64-minimal.iso -O /dev/null
# download ISO to your new partition
wget https://distro.ibiblio.org/almalinux/9.0/isos/x86_64/AlmaLinux-9.0-x86_64-minimal.iso -q -O -|dd of=/dev/vda2 bs=4M
Add grub boot record in old/primary OS
reboot
nano /etc/grub.d/40_custom
# note that the exact format of the below entry
# may vary depending on the OS you're installing.
# the below should work for any version of RHEL 9
# /etc/grub.d/40_custom #
menuentry "/dev/vda2 AlmaLinux-9.0-x86_64-minimal.iso" {
linux (hd0,msdos2)/images/pxeboot/vmlinuz inst.stage2=hd:/dev/vda2
initrd (hd0,msdos2)/images/pxeboot/initrd.img
}
#########################
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot
Done!
Select the new grub menu option you just made to start the installation process. You can't delete the partition in the new OS installer (it's still in use), but afterwards you should have no problem deleting it and expanding the partition you installed the new OS onto.
Comments
(ignore this)
Or just use qemu, seems much easier..
Isn't QEMU a virtualizer, with the overhead that comes with it? I'm not quite sure how the two are comparable. I don't doubt it would be easier, although that's why I decided to make this guide
Installation via qemu using raw disks
qemu-system-x86_64 -hda /dev/sda -cdrom your_iso.iso
Alternatively, you can also boot netboot.xyz if you can do iPXE (implies having VNC), considering you have enough RAM.
You can also prepare a disk image offline, boot a rescue system then dd it onto the disk over SSH.
Worst case, if you have no VNC access and no ability to boot into a rescue system, you can kexec into a small system entirely in memory, freeing the disk so you can do whatever you want to it (e.g. partition, dd an image).