Virt-install Examples: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(6 intermediate revisions by the same user not shown)
Line 7: Line 7:
==Text-Based Anaconda Guest Installation==
==Text-Based Anaconda Guest Installation==


Mount the ISO image under /mnt/dvd:
Make sure the ISO image file ( /archive/rhel-server-7.3-x86_64-dvd.iso in this example) can be read by the user "qemu".
 
<pre>
mount -o loop /root/archive/rhel-server-7.3-x86_64-dvd.iso /mnt/dvd
</pre>
 
<pre>
virt-install --name testvm-01 --memory 1024 --vcpus 2 --os-type=linux --os-variant=rhel7.3 \
--location /mnt/dvd --extra-args="console=tty0 console=ttyS0,115200n8" --disk=/root/archive/rhel-server-7.3-x86_64-dvd.iso,device=cdrom \
--disk=/main-storage-pool/testvm-01.img,size=4 \
--graphics none
</pre>
 
==NAT==
 


The following example assumes that the virtual machine image storage does not exist and it has to be created. The size of the image will be 4 GB and the image format will be by default "qcow2". The example also assumes that the virtualization host [[Linux_Virtualization_Concepts#Storage_Pool|storage pool]] is active and deployed in /main-storage-pool. It is recommended practice to follow the [[Linux_Virtualization_Naming_Conventions#Virtual_Machine_Image_Naming_Convention|virtual machine image name convention]] when naming the media to use for storing the virtual machine image.


The virtual machine will get [[Linux_Virtualization_Concepts#Networking_and_KVM_Virtualization|"default" networking]].


<syntaxhighlight lang='text'>
virt-install \
  --name testvm-01 \
  --memory 2048 \
  --vcpus 2 \
  --os-type=linux \
  --os-variant=centos7.0 \
  --location /iso-images/CentOS-7-x86_64-DVD-7.9.2009.iso \
  --extra-args="console=tty0 console=ttyS0,115200n8" \
  --disk=/iso-images/CentOS-7-x86_64-DVD-7.9.2009.iso,device=cdrom \
  --disk=/main-storage-pool/testvm-01.qcow2,size=10 \
  --network=default \
  --graphics none
</syntaxhighlight>


=Organizatorium=


<font color=red>
<font color=red>
TO TEST:
NAT (TO TEST):
 
NAT:


<pre>
<pre>
Line 36: Line 37:
</pre>
</pre>


External DHCP server:
External DHCP server (TO TEST):


<pre>
<pre>
Line 42: Line 43:
</pre>
</pre>


 
Static IPV4 Address (TO TEST):
Static IPV4 Address:


<pre>
<pre>

Latest revision as of 00:50, 7 December 2020

Internal

Examples

Text-Based Anaconda Guest Installation

Make sure the ISO image file ( /archive/rhel-server-7.3-x86_64-dvd.iso in this example) can be read by the user "qemu".

The following example assumes that the virtual machine image storage does not exist and it has to be created. The size of the image will be 4 GB and the image format will be by default "qcow2". The example also assumes that the virtualization host storage pool is active and deployed in /main-storage-pool. It is recommended practice to follow the virtual machine image name convention when naming the media to use for storing the virtual machine image.

The virtual machine will get "default" networking.

virt-install \
  --name testvm-01 \
  --memory 2048 \
  --vcpus 2 \
  --os-type=linux \
  --os-variant=centos7.0 \
  --location /iso-images/CentOS-7-x86_64-DVD-7.9.2009.iso \
  --extra-args="console=tty0 console=ttyS0,115200n8" \
  --disk=/iso-images/CentOS-7-x86_64-DVD-7.9.2009.iso,device=cdrom \
  --disk=/main-storage-pool/testvm-01.qcow2,size=10 \
  --network=default \
  --graphics none

Organizatorium

NAT (TO TEST):

virt-install --network=default --name=rhel7-machine --ram=756 --vcpus=4 --os-type=linux --os-variant=rhel7

External DHCP server (TO TEST):

virt-install --network=br0 \ --name=rhel7-machine --ram=756 --vcpus=4 \ --os-type=linux --os-variant=rhel7

Static IPV4 Address (TO TEST):

virt-install \ --network=br0 \
--name=rhel7-machine --ram=756 --vcpus=4 \ --os-type=linux --os-variant=rhel7 \ --extra-args="ip=192.168.1.2::192.168.1.1:255.255.255.0:test.example.com:eth0:n one

The arguments of the --extra-args parameter specify the static network setting, using the following structure:

ip=[ip]::[gateway]:[netmask]:[hostname]:[interface]:[autoconf]