mirror-env/libvirt/README.md

4.3 KiB

Installation

Prerequisites (debian)

Install QEMU and KVM

$ apt install --no-install-recommends qemu-system libvirt-clients libvirt-daemon-system

Install other packages for the playbook

$ apt install ansible cloud-image-utils dnsmasq ovmf python3

Packages I can't tell if you need or not

virtinst 
virt-manager
bridge-utils 

Then install virt-viewer to interact run through the install with

virt-viewer 

Prerequisites (archlinux)

needs update

$ pacman -S qemu libvirt virt-install virt-viewer ansible 

Running the Playbook

Run the playbook from one directory down

ansible-playbook -K libvirt/main.yml

Then connect to the created vm using virt-viewer

virt-viewer --domain-name mirror

If vm is on a remote machine

virt-viewer --connect qemu+ssh://user@X.X.X.X/system mirror

Follow the steps under Installing Ubuntu before continuing


container may stop so will need to start with

virsh start mirror

after starting check the ip address of the vm with

virsh net-dhcp-leases mirbr0

and ssh

ssh local@192.168.123.XXX

In the vm switch to root, install some packages, and clone the repo.

$ sudo su
$ cd
$ apt update && apt upgrade
$ apt install git ansible
$ git clone https://git.csclub.uwaterloo.ca/public/mirror-env.git

Then enter mirror-env/mirror and follow the instructions there.

Troubleshooting

net.ipv4.ip_forward = 1
modprobe kvm_intel

If running in /root may need to edit config

# edit /etc/libvirt/qemu.conf
user = "root"
group = "root"
$ service restart libvirtd

Installing Ubuntu

  • user: local
  • password: password

Note: the resulting system created from following these steps should look like this:

$ lsblk
NAME           MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
loop0            7:0    0 55.4M  1 loop  /snap/core18/2128
loop1            7:1    0 32.3M  1 loop  /snap/snapd/12704
loop2            7:2    0 70.3M  1 loop  /snap/lxd/21029
loop3            7:3    0 32.3M  1 loop  /snap/snapd/13170
loop4            7:4    0 61.8M  1 loop  /snap/core20/1081
loop5            7:5    0 67.3M  1 loop  /snap/lxd/21545
sr0             11:0    1 1024M  0 rom   
vda            252:0    0   10G  0 disk  
├─vda1         252:1    0  512M  0 part  /boot/efi
└─vda2         252:2    0  9.5G  0 part  
  └─md0          9:0    0  9.5G  0 raid1 
    └─vg0-root 253:0    0  9.5G  0 lvm   /
vdb            252:16   0   10G  0 disk  
├─vdb1         252:17   0  512M  0 part  
└─vdb2         252:18   0  9.5G  0 part  
  └─md0          9:0    0  9.5G  0 raid1 
    └─vg0-root 253:0    0  9.5G  0 lvm   /
vdc            252:32   0   10G  0 disk  
vdd            252:48   0   10G  0 disk  
vde            252:64   0   10G  0 disk  
vdf            252:80   0   10G  0 disk  

Create a new user with

  • username: local
  • password: password

You can ignore this error and just press enter

Now you go back to Running the Playbook