The
virt-manager
application is a desktop user interface for managing virtual machines throughlibvirt
[1].
You can use UI applications to do the following steps, but it wouldn't be funny. So, let's go in the most interestingly.
To install it on Ubuntu is easy.
sudo apt-get install virt-manager
You can set some resources when you are creating virtual machines on virt-manager
, for example:
- Name of the guest instance
- Number of vcpus
- Guest memory allocation
- Disk size
- Installation media
Although you have a UI to use, there is a way to provision operating systems from an ISO using a command-line tool.
sudo virt-install --name vm1 --vcpus 2 --memory 2048 \
--disk size=25 \
--cdrom /home/server/iso/some-os.iso
sudo virt-install --name vm1 --vcpus 2 --memory 2048 \
--disk path=/media/server/vms/vm1.raw,format=raw,size=25 \
--cdrom /home/server/iso/some-os.iso
There is a lightweight user interface for interacting with the virtualized guest OS: virt-viewer
.
But, first, you need to start the virtual machine, but I didn't find a way to do this using virt-manager
.
Then, we will use virsh
to that.
sudo virsh start vm1
virt-viewer vm1
It too easy: find the virtual machine IP and SSH it.
sudo virsh domifaddr vm1
ssh user@<vm1-ip-address>
The VM system may not have SSH installed by default. Then, you need to install it first. On Ubuntu, you can do it quickly. If your system has an enabled firewall, make sure to open the SSH port.
sudo apt-get install openssh-server
sudo ufw allow ssh
You must pause or shut off the virtual machine to clone it.
So, you can use a command-line tool: virt-clone
.
sudo virsh shutdown vm1
sudo virt-clone --original vm1 --name vm2 --auto-clone