Differences between revisions 2 and 3
Revision 2 as of 2017-10-12 20:29:37
Size: 1091
Editor: shran
Comment:
Revision 3 as of 2017-10-12 20:37:01
Size: 1480
Editor: shran
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
A domain is really the virtual machine. Creating a new domain is just one simple command. `virt-install`. It takes a lot of parameters though. Use the following script to create your domains. A domain is really the virtual machine. Creating a new domain is just one simple command. `virt-install`. It takes a lot of parameters though, it is adviseable to read `man virt-install`.
Line 5: Line 5:
== Creation ==
Use the following script to create your domains.

`createdomain.sh`
Line 35: Line 39:
== Parameters ==
||`--name`||Give the domain its name. This name is used byt the virsh software as a reference to the domain.||
||`--memory`||The amount of memory for the domain. Setting a high value to make the istallation run smoother can be a good idea. It is possible to lower the memory later on||

Domain Creation

A domain is really the virtual machine. Creating a new domain is just one simple command. virt-install. It takes a lot of parameters though, it is adviseable to read man virt-install.

Creation

Use the following script to create your domains.

createdomain.sh

NAME="stretch-template"
RAM="1024"
LVM_SIZE="4G"
LVM_GROUP="vg2"
GRAPHICS_PROTOCOL="spice" #spice, vnc
OS="debian9"
MEDIA="/mnt/media/debian/stretch/debian-9.1.0-amd64-netinst.iso"

if [ $# -eq 0 ]
then
        echo "${0}: domain-name"
else
        NAME=${1}
fi
LVM_NAME="kvm_${NAME}_vda"

if [ ! -e /dev/${LVM_GROUP}/${LVM_NAME} ]
then

        # create lvm partition
        lvcreate --size ${LVM_SIZE} --name ${LVM_NAME} ${LVM_GROUP}

        # create the virtual machine
        virt-install --name ${NAME} --memory ${RAM} --disk /dev/${LVM_GROUP}/${LVM_NAME},bus=virtio,format=raw --os-variant ${OS} --network bridge=br0,model=virtio --cdrom ${MEDIA} --graphics ${GRAPHICS_PROTOCOL},listen=192.168.1.33,password=${NAME} --noautoconsole --virt-type kvm
else
        echo "${0}: refusing to overwrite existing domain";
fi

Parameters

--name

Give the domain its name. This name is used byt the virsh software as a reference to the domain.

--memory

The amount of memory for the domain. Setting a high value to make the istallation run smoother can be a good idea. It is possible to lower the memory later on

None: Domain Creation (last edited 2021-12-31 11:56:37 by Kristian Kallenberg)