Skip to content

Create a custom image

Côme Tardivel edited this page Mar 18, 2024 · 6 revisions

Windows and linux

  1. Create a new directory on /opt/unetlab/addons/qemu/

For Linux :

mkdir /opt/unetlab/addons/qemu/linux-<...>/

For Windows :

mkdir /opt/unetlab/addons/qemu/win-<...>/

Examples :

mkdir /opt/unetlab/addons/qemu/linux-ubuntu-desktop-16.04.02/ or mkdir /opt/unetlab/addons/qemu/win-10-22H2/

2 - Copy the ISO file

Use WinSCP or FileZilla SFTP or SCP (port 22) to copy distro ISO image into the newly created directory path and rename the file to cdrom.iso :

mv win1022H2.iso cdrom.iso

3 - Create a new virtual HDD named virtioa.qcow2 :

/opt/qemu/bin/qemu-img create -f qcow2 virtioa.qcow2 35G, The disk size can be changed, in this example it is 35GB.

4 - Now connect to the EVE-NG interface to create a new lab. Add a new node, in the list you find the folder previously created. When starting the node you will have to perform a standard installation as if it were a VM. When you have finished configuring your new machine you must shut it down properly to move on to the next step

Commit the new image :

On the left side-bar within the lab in the EVE Web-UI choose “Lab Details” to get your lab’s UUID details :

Now you need to get the id of the node you just created :

Then you must retrieve the ID of your user (For the admin user it is 0):

Now we need to go to the temporary image folder:

cd /opt/unetlab/tmp/<user-ID>/<lab-UUID>/<node-ID>/

Example for node 15 from the admin account: cd /opt/unetlab/tmp/0/c294fefe-9f09-484a-9b45-cc01b6de3f80/15/

and commit the image :

/opt/qemu/bin/qemu-img commit virtioa.qcow2

Finally we can go and delete the cdrom.iso in the folder created at the beginning :

cd /opt/unetlab/qemu/<image_name>

rm -f cdrom.iso