Difference between revisions of "Virtual Machine (KVM)"

From vwiki
Jump to navigation Jump to search
m (→‎Create Virtual Machine: Minor update to table - Still WIP/draft)
(Still WIP - added Create Server (no GUI))
Line 13: Line 13:
== Create Virtual Machine ==
== Create Virtual Machine ==


virt-install
{| class="vwikitable"
{| class="vwikitable"
|-
|-
Line 40: Line 39:
| <code>network</code>        || bridge:br0                  || Network connection details
| <code>network</code>        || bridge:br0                  || Network connection details
|}
|}
=== Create Server (no GUI) ===
Update paths to reflect where install ISO, and where VM disk files are intended to be
<pre>
virt-install \
--virt-type=kvm \
--name server-name \
--ram 1024 \
--vcpus=1 \
--os-variant=ubuntu16.04 \
--network=bridge=virbr0,model=virtio \
--graphics none \
--disk path=/mnt/md0/kvm/vm/server-name.img,size=20,bus=virtio \
--extra-args "console=ttyS0" \
--location /mnt/md0/kvm/iso/ubuntu-16.04.3-server-amd64.iso
</pre>


[[Category:KVM]]
[[Category:KVM]]

Revision as of 16:36, 12 February 2018

Prerequisites

This guide assumes you have a basic working environment, run the kvm-ok command to sanity check...

root@kvm-host:# kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used

Install Media

You need to have a local copy of the appropriate ISO. If you have the ISO file already, upload to your KVM server, alternatively download from the site using wget

Create Virtual Machine

Parameter Example Usage
name VM-Name Name of virtual machine (typically this should match the intended hostname of the VM)
description "Test VM to be used for X" Description of virtual machine's purpose etc
os-type Linux OS family, can be Linux, Solaris, Unix or Windows
os-variant ubuntu16.04 Distribution type for the above (run osinfo-query os to view what is available)
ram 2048 vRAM in GB
vcpus 2 vCPUs (cores)
vcpus 2 vCPUs (cores)
disk path /vm-store/images/VM-Name.img,bus=virtio,size=50 Virtual disk path, using virtio bus and with a 50GB disk
graphics none If noneset, VM will be created with a serial display output (as opposed to VNC window)
cdrom /home/user/cdrom.iso Path to installation ISO
network bridge:br0 Network connection details

Create Server (no GUI)

Update paths to reflect where install ISO, and where VM disk files are intended to be

virt-install \
--virt-type=kvm \
--name server-name \
--ram 1024 \
--vcpus=1 \
--os-variant=ubuntu16.04 \
--network=bridge=virbr0,model=virtio \
--graphics none \
--disk path=/mnt/md0/kvm/vm/server-name.img,size=20,bus=virtio \
--extra-args "console=ttyS0" \
--location /mnt/md0/kvm/iso/ubuntu-16.04.3-server-amd64.iso