Virtual Private Servers - Installing Operating System from custom image on OVH VPS ( CentOS 8 Tutorial)
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
Frage

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

Von
KonradZ
Erstellungsdatum 2020-01-11 21:11:48 (edited on 2024-09-04 14:25:42) in Virtual Private Servers

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@ -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)


1 Antwort ( Latest reply on 2025-11-12 09:00:05 Von
Clown
)

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.

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

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

erm not sure if ovh changed the way the dveices work or something but using the command specified replacing -localtime since its now defunct with -rtc base=localtime but i get this error qemu-system-x86_64 -netdev type=user,id=mynet0 -device virtio-net-pci,netdev=mynet0 -m 2048 -rtc base=localtime -enable-kvm -drive index=0,media=disk,if=virtio,file=/dev/sdb -vga qxl -spice port=5901,addr=127.0.0.1,disable-ticketing -daemonize -cdrom $MYISO -boot d
WARNING: Image format was not specified for '/dev/sdb' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.


if i specify raw like this i get the follow error

$ qemu-system-x86_64 -netdev type=user,id=mynet0 -device virtio-net-pci,netdev=mynet0 -m 2048 -rtc base=localtime -enable-kvm -drive index=0,media=disk,format=raw if=virtio,file=/dev/sdb -vga qxl -spice port=5902,addr=127.0.0.1,disable-ticketing -daemonize -cdrom $MYISO -boot d
qemu-system-x86_64: -drive index=0,media=disk,format=raw: A block device must be specified for "file"

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

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

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

Dear,

I have a vps on ovh and when following your steps, I have an error.

$ 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 /dev/debian-
11.3.0-amd64-netinst.iso -boot d

qemu-system-x86_64: -localtime: invalid option

I tried to remove the -localtime parameter and then I have a second error :

[RESCUE] root@vps-dbxxxxxx:/dev $ qemu-system-x86_64 -netdev type=user,id=mynet0 -device virtio-net-pci,netdev=mynet0 -m 2048 -enable-kvm -drive index=0,media=disk,if=virtio,file=/dev/sdb -vga qxl -spice port=5901,addr=127.0.0.1,disable-ticketing -daemonize -cdrom /dev/debian-11.3.0-amd6
4-netinst.iso -boot d

(process:2054): Spice-WARNING **: 18:17:58.139: reds.c:2645:reds_init_socket: binding socket to 127.0.0.1:5901 failed
qemu-system-x86_64: failed to initialize spice server

Any idea ?

Best Regards,

Reviving this thread as a I need some assistance.

So im running

> apt install qemu-kvm

> wget -P /tmp https://1global.3cx.com/downloads/debian10iso/debian-amd64-netinst-3cx.isoglobal.3cx.com/downloads/debian10iso/debian-amd64-netinst-3cx.iso

Start up the KVM

>qemu-system-x86_64 -net nic -net user,hostfwd=tcp::80-:80,hostfwd=tcp::443-:443 -m 1024M -enable-kvm -hda /dev/sda -hdb /dev/sdb -vnc 127.0.0.1:0 -cdrom /tmp/debian-amd64-netinst-3cx.iso -boot once=d

>ssh root@IP -L 5900:localhost:5900

I can access the VPS with VNC viewer and install the ISO successfully to sdb1. However, when I reboot the machine in normal mode It does not boot.

Any advice on how to get this to boot?

This concise guide outlines the steps to install a custom ISO on a VPS: roboots into rescue mode, unmount partitions, install necessary packages (e.g., `qemu-kvm`), download the ISO (e.g., CentOS 8), run it with QEMU, establish an SSH tunnel for SPICE access, perform the installation, and finally, verify the new system after reboot.

Thanks for this. 

Had some trouble with Alma 10 as the boot image is 800mb, for which there isn't enough room on root.

GPT suggested to cd to /dev/shm (apparently uses RAM) and then ran a similar set of commands.  

 

And then how do you configure the rest of the machine to replicate what OVH does with their own images (e.g. set up the network)?