diff --git a/README.md b/README.md index b95a55b..c8c2625 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,73 @@ # Mirror Env -## Setup -Open the file `mirror-vm` to install the dependencies and update its variables to reflect your environment. Then download the Ubuntu 20.04 iso and create the vm. +This script helps quickly set up a vm development environment for cs club's mirrors. + +## Installation +Install the following dependencies +- qemu +- genisoimage +- ovmf (find the location of OVMF\_CODE.fd, it is system dependent) + +Edit the configuration variables in the script file to reflect your system. + +The `mirror-vm` script will will automatically install ubuntu using the [autoinstall](https://ubuntu.com/server/docs/install/autoinstall) feature. ``` curl -O https://releases.ubuntu.com/20.04/ubuntu-20.04.2-live-server-amd64.iso -./mirror-vm create -./mirror-vm run-install +$ ./mirror-vm create +$ ./mirror-vm run-install ``` + +To view the vm, you also need a vnc viewer. [TigerVNC](https://github.com/TigerVNC/tigervnc) is a good choice. Simply run +``` +$ vncviewer :5900 +``` + +Due to the way the ubuntu autoinstall is designed, user confirmation is required to start the autoinstallation process. Enter `yes` when prompted with this line: +``` +Continue with autoinstall (yes|no) +``` + +After going through the install process you can run the vm with +``` +$ ./mirror-vm run +``` + +The default login user has +``` +username: ubuntu +password: ubuntu +``` + +## Post-Installation +There are some things that will not be setup post install. As of now, it is also required to run a shell script to further configure the system. We will streamline this in the future. + +## System Details +For those that are interested. + +relevant lsblk output: +``` +NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT +vda 252:0 0 10G 0 disk +├─vda1 252:1 0 500M 0 part /boot/efi +└─vda2 252:2 0 9G 0 part + └─md0 9:0 0 9G 0 raid1 + └─vg0-root 253:0 0 8G 0 lvm / +vdb 252:16 0 10G 0 disk +├─vdb1 252:17 0 500M 0 part +└─vdb2 252:18 0 9G 0 part + └─md0 9:0 0 9G 0 raid1 + └─vg0-root 253:0 0 8G 0 lvm / +vdc 252:32 0 10G 0 disk +├─vdc1 252:33 0 10G 0 part +└─vdc9 252:41 0 8M 0 part +vdd 252:48 0 10G 0 disk +├─vdd1 252:49 0 10G 0 part +└─vdd9 252:57 0 8M 0 part +vde 252:64 0 10G 0 disk +├─vde1 252:65 0 10G 0 part +└─vde9 252:73 0 8M 0 part +vdf 252:80 0 10G 0 disk +├─vdf1 252:81 0 10G 0 part +└─vdf9 252:89 0 8M 0 part +``` + +Drives vda and vdb are for the main filesystem, they use raid1. Drives vdc, vdd, vde and vdf are in a raidz2 zpool. diff --git a/mirror-vm b/mirror-vm index 75ede54..913ce21 100755 --- a/mirror-vm +++ b/mirror-vm @@ -3,18 +3,19 @@ # script for managing the vm for the csc mirror dev environment # dependencies =-=-=-=-=-=-=-= -# qemu, qenisoimage, ovmf (find the location of OVMF_CODE.fd on your system) +# qemu, genisoimage, ovmf (find the location of OVMF_CODE.fd on your system) # user config variables =-=-= disk_size=10G vm_mem=2G ovmf_location=/usr/share/edk2-ovmf/x64/OVMF_CODE.fd install_iso=./ubuntu-20.04.2-live-server-amd64.iso +ssh_port=7777 -.PHONY: help create purge run-install run +.PHONY: help create clean run-install run help: - echo help|create|purge|run-install|run + echo help|create|clean|run-install|run .ONESHELL: create: @@ -22,7 +23,7 @@ create: qemu-img create -f qcow2 drive$$i ${disk_size}; done genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data -purge: +clean: rm drive* seed.iso run-install: @@ -47,6 +48,6 @@ run: -drive file=drive6,if=virtio,id=f,media=disk,format=qcow2 \ -bios ${ovmf_location} \ -m ${vm_mem} \ - -net user,hostfwd=tcp::7777-:22 \ + -net user,hostfwd=tcp::${ssh_port}-:22 \ -net nic