Machine/template-focal

From Sugar Labs
Jump to navigation Jump to search

VM Creation (host part)

virt-install -v --accelerate --nographics -x console=ttyS0,115200 \
--name template-focal --vcpus=3 --ram $((1 * 1024)) \
--os-type=linux --os-variant=ubuntu18.04 --network bridge:br0 \
--disk path=/var/lib/libvirt/images/boot/template-focal-boot.img,bus=virtio,size=0.25,format=raw \
--disk path=/dev/justice/template-focal-root,bus=virtio,size=10 \
--location http://ubuntu.media.mit.edu/ubuntu/dists/focal/main/installer-amd64/


Obs: format=raw is mandatory, otherwise qcow2 format will be used by default. raw format allows us to easily create device mappings for the image.


The new VM will boot into the installer. Answer all questions with the defaults, except:

  1. Hostname: template-focal
  2. Mirror: enter information manually
  3. Mirror hostname: ubuntu.media.mit.edu
  4. (create your user with a strong password and no encrypted home)
  5. Partitioning: manual (see Partitioning below)
  6. Automatically install security updates
  7. Software selection:
    • Basic Ubuntu Server
    • OpenSSH server
  8. GRUB: let the installer setup grub on /dev/vba (which contains /boot)


Partitioning

The goal is to have a small disk file for the MBR and /boot, and a larger raw filesystem in an LVM Logical Volume. We don't want the LV to be partitioned because this makes it harder to resize, mount, etc.

Now create a partition table in the smallest disk (256MB) and create a single partition in it. Format this partition as ext4, labeled "boot" and mounted as /boot.

The installer won't let you format the entire disk as a filesystem, so go ahead and partition the 10GB disk too, then create a primary partition in it and format it as ext4, mounted as / and labeled "template-xenial" ("template-focal-root" would exceed the ext4 limit).

And yes.. just in case you're wondering. We don't use swap partitions.

We'll have to fix the disk later.