OVHcloud Community

Welcome to your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.

Installing Operating System from custom image on OVH VPS ( CentOS 8 Tutorial)


#1

In theory this should work with any custom ISO, however I tested only with CentOS 8

1) Reboot VPS in rescue mode

2) Connect to Rescue Mode via SSH, unmount /dev/sdb1 and remove all partitions:

# lsblk
# umount /dev/sdb1
# fdisk -u /dev/sdb
> d
> d 
> w

3) Install required packages:

# apt install qemu-kvm

4) Download your ISO - usually Rescue Mode has very little space so you may want to download NetInst/Minimal ISO:

# wget http://mirror.ox.ac.uk/sites/mirror.centos.org/8.0.1905/isos/x86_64/CentOS-8-x86_64-1905-boot.iso

5) Run qemu (replace ISO location and vdisk name if required):

# qemu-system-x86_64 -netdev type=user,id=mynet0 -device virtio-net-pci,netdev=mynet0 -m 2048 -localtime -enable-kvm -drive index=0,media=disk,if=virtio,file=/dev/sdb -vga qxl -spice port=5900,addr=127.0.0.1,disable-ticketing -daemonize -cdrom /tmp/CentOS-8-x86_64-1905-boot.iso -boot d

6) Assuming your workstation is running Linux, forward a port through an SSH tunnel to your VPS:

# ssh -4 -v root@<your_vps_ip> -L 5900:localhost:5900

7) On your localhost, connect to SPICE running on local port 5900:

# remote-viewer
> spice://127.0.0.1?port=5900

8) Perform installation as usual.

Note: Since you downloaded Minimal/NetInst image, you need to configure source installation.
For CentOS 8 I used:

a) http
b) repository URL
c) mirror.centos.org/centos/8/BaseOS/x86_64/os/

9) Reboot server and exit Rescue Mode.

10) Connect to your new instance running CentOS 8:

# cat /etc/redhat-release 
CentOS Linux release 8.0.1905 (Core)

#2

Thanks for the great tutorial guide.

Is there any limit to the size of the rescue area?

I would like to mount a Windows XP or 7 ISO, do you have tutorial guide for that?

Thank you very much.


#3

If there isn’t room on the rescue disk for a larger ISO, you could copy it to a RAM disk…

mkdir /mnt/ramdisk
mount -t tmpfs -o rw,size=2G tmpfs /mnt/ramdisk

#5

okay so i can get this to boot with a little fiddling but wqhen i get to pick disk in windows installer no disks appear any idea why


#6

HI @BenD

It happens because you have to load the virtio drivers for Microsoft Windows to find the corresponding signatures to identify virtual machine disks on Linux.

You can download it from here

https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.190-1/

Although you don’t need to create a Virtual Machine to install custom ISOs or Microsoft Windows. This can be done from IPMI (Java KVM Console) provided by OVH / Soyoustart

You can also do it through rescue mode with a little more advanced experience

At least, with the IPMI / KVM Console you can mount a remote hard disk and perform the installations directly on the machine without virtualizing

I hope I have clarified or helped

Regards,
Carlos Frias (SysAdmin)
Sysdop


#7

Hi @sysdop
I’m training to install Rocky Linux 8.4 RC1 using your approach.
Boot iso image is too largem then I’m using an 800MB ramdisk.
This is my command:
qemu-system-x86_64 -netdev type=user,id=mynet0 -device virtio-net-pci,netdev=mynet0 -m 1024 -enable-kvm -drive index=0,media=disk,if=virtio,file=/dev/sdb,format=raw -vga qxl -spice port=5900,addr=127.0.0.1,disable-ticketing -daemonize -cdrom /mnt/ramdisk/Rocky-8.4-x86_64-boot.iso -boot d
The virtual machine seems to boot smoothly, but when anaconda is starting, qemu crash without particular message. Find atteched the log file.

main_channel_link: add main channel client
main_channel_client_handle_pong: net test: latency 34.538000 ms, bitrate 11607542 bps (11.069815 Mbps)
red_qxl_set_cursor_peer:
inputs_connect: inputs channel client create
Killed

What’s happening?
Thanks so much.

Ivan