Difference between revisions of "KVM"

From WeBWorK_wiki
Jump to navigation Jump to search
Line 3: Line 3:
 
====Importing the ova File====
 
====Importing the ova File====
 
sudo apt install virt-v2v
 
sudo apt install virt-v2v
  +
 
sudo virt-v2v -i ova WW2.18_Ubuntu22.04_Server.ova -of qcow2
 
sudo virt-v2v -i ova WW2.18_Ubuntu22.04_Server.ova -of qcow2
   
   
sudo virt-v2v -i ova guestvm1.ova -of qcow2
 
  +
   
   

Revision as of 15:02, 7 September 2023

QEMU/KVM running on a Ubuntu 20.04 Desktop host

First install Qemu-KVM . See e.g. https://itslinuxfoss.com/install-kvm-ubuntu-22-04/

Importing the ova File

sudo apt install virt-v2v

sudo virt-v2v -i ova WW2.18_Ubuntu22.04_Server.ova -of qcow2



First cd to whatever directory you downloaded the WW2.16_Ubuntu20.04_Server.ova file to, (maybe "Downloads"). Then untar it

tar -xvf WW2.16_Ubuntu20.04_Server.ova

which might take awhile and then run the command

sudo virt-convert WW2.16_Ubuntu20.04_Server.ovf -D qcow2 --destination /var/lib/libvirt/images/

This will take awhile but eventually your guest WeBWorK server will start up automatically in a Virt Viewer window. Login as wwadmin with password wwadmin and then go on to the next section.

Networking

Accessing your server involves the same procedure as in VirtualBox 6 running on a Windows 10 host above. So you have to

  1. Find the name and MAC address of the virtual nic (network interface card)
  2. Edit 00-installer-config.yaml
  3. Reboot your WeBWorK guest
  4. Find your WeBWorK guest's ip address

See VirtualBox 6 running on a Windows 10 host above for details.

Except that

  1. You do not need port forwarding
  2. Instead of using a terminal emulator, just open a terminal window on your host and ssh into your new system, e.g.
$ ssh  wwadmin@192.168.122.233

(where of course you need to use the actual ip address of your guest WeBWorK server).

Now login to your server using the password "wwadmin".

Expand the disk drive

You can do most of this from the graphical Virtual Machine Manager (select the machine, then Edit, Virtual Machine Details). Below are commands to this from the command line. I think you have to actually expand the disk from the command line but you can get information and add cpu's and/or memory from the graphical Virtual Machine Manager.

I'm assume the name of your WeBWorK guest is wwserver and it is Shutoff. First find the location of the disk. Run the command

$ sudo virsh domblklist wwserver
[sudo] password for wwadmin: <wwadmin password>

and you will see something like

 Target   Source
-------------------------------------------------------------------------
 sda      /var/lib/libvirt/images/WW2.15_Ubuntu20.04_Server-disk1.qcow2

Now get some info about the disk

$ sudo qemu-img info /var/lib/libvirt/images/WW2.15_Ubuntu20.04_Server-disk1.qcow2
[sudo] password for wwadmin: <wwadmin password>

and you will see something like

image: /var/lib/libvirt/images/WW2.15_Ubuntu20.04_Server-disk1.qcow2
file format: qcow2
virtual size: 12 GiB (12884901888 bytes)
disk size: 6.76 GiB
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false

and now lets resize it to 20 GB by adding 8 GB

sudo qemu-img resize /var/lib/libvirt/images/WW2.15_Ubuntu20.04_Server-disk1.qcow2 +8G
[sudo] password for wwadmin: <wwadmin password>
Image resized.

You still have to repartition the disk and expand the file system on you guest. For that see Increase disk space above.

Continue the Installation

Return to the Accessing Your Server from a Terminal Emulator on your Host instructions above.