Difference between revisions of "Virtual Machine Management"

From CSLabsWiki
(Center images, make them smaller)
Line 19: Line 19:
Select "browse local" and find the ISO you're using.
Select "browse local" and find the ISO you're using.

Revision as of 17:29, 18 July 2015

There are two possible things you want to do. Create a new virtual machine instance on the existing infrastructure ("spinning up a vm") or create a new base image suitable for use with the infrastructure.

Spinning up a VM


Creating a new base image

To the largest extent possible, we use ansible to manage service configuration and machine bringup. Because ansible does all of the necessary configuration, the base images should be as stock as possible.

Creating a VM Environment

The easiest way to use virtualization on Linux is with virt-manager. On Ubuntu, follow [1]. It is packaged on most distros. Make sure to check your distro's documentation, as you likely need to add yourself to a certain group to get permissions to manage virtual machines. Download a setup ISO for the distro you are creating a base image for. Here's some screenshots of the steps to follow.

Virtual Machine Manager 003.png

New VM 004.png

New VM 005.png

Select "browse local" and find the ISO you're using.

Locate ISO media volume 007.png

New VM 008.png

The settings you use here don't particularly matter, since only the resulting disk image will be used.

New VM 009.png

Select 16GiB, which is our default base disk size.

New VM 010.png

Click "finish"

Installing and Configuring Debian

Boot the new VM, and select "install".

VM 012.png

Select the locale.

VM 014.png

VM 015.png

VM 016.png


VM 017.png

The default hostname is fine, Ansible will change it when necessary.

VM 018.png

Leave this empty.

VM 019.png

Enter the COSI Default Root Password.

VM 020.png

VM 021.png

Create the ansible user.

VM 022.png

VM 023.png

Use cspassword.

VM 024.png

VM 025.png

The defaults here are fine.

VM 026.png

VM 027.png

VM 028.png

VM 029.png

Finish partitioning.

VM 030.png

Write changes.

VM 031.png


VM 032.png

Chose US.

VM 033.png

Chose the default.

VM 034.png

No proxy.

VM 035.png

Don't participte in the popularity contest.

VM 036.png

Use the arrow keys and spacebar to deselect everything and select SSH server, then continue.

VM 039.png

Use the defaults for GRUB.

VM 040.png

VM 041.png


VM 042.png

Installation complete!

VM 043.png

Now that installation is complete, some additional setup is needed. Log in as root.

apt install ca-certificates sudo
gpasswd -a ansible sudo
systemctl enable getty@ttyS0
su ansible
mkdir .ssh
cd .ssh
wget https://raw.githubusercontent.com/COSI-Lab/ansible/master/authorized_keys

The first command installs TLS certificates (needed for the later wget) and sudo (so the ansible user can elevate permissions). The third command enables a login console on the ttyS0 device, which will be used for 'virsh console' later. The rest is setting up ansible's public key for configuration when a new VM is spinned up from this image.