Difference: CreatingKVMImages (1 vs. 6)

Revision 62011-08-02 - rrusnak

Line: 1 to 1
 
META TOPICPARENT name="UvicKVMResources"
Line: 33 to 33
  --extra-args="serial console=tty0 console=ttyS0,115200"
Added:
>
>
The following example will create a 5GB guest image and start a net based install of ubuntu 10.10. Once again the --nographics option will be used.

sudo virt-install --connect qemu:///system --name maverick --disk path=/tmp/maverick.img --file-size=5 --ram=512 --accelerate --network=bridge:virbr0 --location http://ftp.ubuntu.com/ubuntu/dists/maverick/main/installer-i386/ --nographics --extra-args="console=ttyS0"

(Note: I seem to have more luck creating guests while using net installs as opposed to iso files. Here are some common locations:

Fedora: http://download.fedoraproject.org/pub/fedora/linux/releases/13/Fedora/i386/os/ Change "13" to the Fedora release, and "i386" to x86_64 for a 64 bit guest. 
Debian: http://ftp.us.debian.org/debian/dists/stable/main/installer-i386/ Change "us" to your country code (for faster access to a local mirror), and "i386" to amd64 for a 64 bit guest. 
Ubuntu: http://ftp.ubuntu.com/ubuntu/dists/maverick/main/installer-i386/ Change "maverick" to the name of the version of Ubuntu to install, and "i386" to amd64 for a 64 bit guest.
 NOTES:
  • The --accelerate option used in previous versions of this document is now depreciated in new versions of virt-install.
  • the --cdrom option can point to an actual drive (ie, /dev/hdc), or a iso file on your local machine.

Revision 52010-06-29 - mvliet

Line: 1 to 1
 
META TOPICPARENT name="UvicKVMResources"
Line: 18 to 18
  --name sl53 --ram 256 --disk path=/home/mvliet/sl53-pvm.img,bus=virtio,size=10,sparse=true
Deleted:
<
<
--accelerate
  --cdrom /home/mvliet/SL.53.031809.DVD.i386.disc1.iso
Line: 29 to 28
  --name fedora2 --ram 512 --disk path=/home/mvliet/fedora.img,bus=virtio,size=10,sparse=true
Deleted:
<
<
--accelerate
  --location http://download.fedoraproject.org/pub/fedora/linux/releases/10/Fedora/i386/os/ --nographics --extra-args="serial console=tty0 console=ttyS0,115200"

NOTES:

Changed:
<
<
  • When creating a KVM guest you must always use the --accelerate option. If you do not, it will fall back to QEMU emulation.
>
>
  • The --accelerate option used in previous versions of this document is now depreciated in new versions of virt-install.
 
  • the --cdrom option can point to an actual drive (ie, /dev/hdc), or a iso file on your local machine.
  • use --location for a remote file (ftp, http, etc.).
  • ram is specified in MB, disk size is specified in GB.

Revision 42010-06-22 - mvliet

Line: 1 to 1
 
META TOPICPARENT name="UvicKVMResources"
Line: 22 to 22
  --cdrom /home/mvliet/SL.53.031809.DVD.i386.disc1.iso
Added:
>
>
The example below will create a 10GB guest image and start a net based install of fedora10. To achieve a truly text-only install, the --nographics option is used in combination with the --extra-args option. The provided arguments for the --extra-args option are specific to the Anaconda installer and inform it to enable a serial console for the installation process. Since the default behavior of virt-install is to connect to the guest console, you will immediately be connected to the serial console you told Anaconda to create. This method will also work for RedHat based distros (rhel, centos, scientific linux, etc.) as they will all use Anaconda.
sudo virt-install --connect qemu:///system \
    --os-type linux \
    --name fedora2 \
    --ram 512 \
    --disk path=/home/mvliet/fedora.img,bus=virtio,size=10,sparse=true \
    --accelerate \
    --location http://download.fedoraproject.org/pub/fedora/linux/releases/10/Fedora/i386/os/ \
    --nographics \
    --extra-args="serial console=tty0 console=ttyS0,115200"
 NOTES:
  • When creating a KVM guest you must always use the --accelerate option. If you do not, it will fall back to QEMU emulation.
Changed:
<
<
  • the --cdrom option can point to an actual drive (ie, /dev/hdc), or a iso file on your local machine, or even a remote file (ftp, http, etc.).
>
>
  • the --cdrom option can point to an actual drive (ie, /dev/hdc), or a iso file on your local machine.
  • use --location for a remote file (ftp, http, etc.).
 
  • ram is specified in MB, disk size is specified in GB.
  • the --disk option may be of more use to you the --file.

Revision 32009-04-09 - mvliet

Line: 1 to 1
 
META TOPICPARENT name="UvicKVMResources"
Line: 9 to 9
  Since the man page for this program contains most information you would want to know, I will keep this section short with just an example and a few quick notes.
Changed:
<
<
This example will create a 10GB disk image and start the installation from an iso located at /home/bob/sl52DVD.iso. The guest is given 512MB of memory, and it will use br0 for its network connection.
>
>
The below example will create a 10GB sparse backing file, and start the installation from the ISO image specified in the --cdrom option. The disk is specified as having a bus type of virtio, this is only available if your distro has virtio drivers available. As of SL5.3 (RHEL5.3) the virtio drivers have been backported as well as all necessary software to support virtio(lvm2, etc) upgraded to enable you to use virtio. If you are using SL5.2 or less you must remove the bus=virtio option.
 
Changed:
<
<
virt-install --connect qemu:///system --name sl52base --ram 512 --file /opt/workspace/images/sl52base --file-size 10 --network BRIDGE:br0 --accelerate --os linux
>
>
virt-install --connect qemu:///system --os-type linux
  --os-variant rhel5
Changed:
<
<
--cdrom /home/bob/sl52DVD.iso
>
>
--name sl53 --ram 256 --disk path=/home/mvliet/sl53-pvm.img,bus=virtio,size=10,sparse=true --accelerate --cdrom /home/mvliet/SL.53.031809.DVD.i386.disc1.iso
 

NOTES:

Revision 22009-03-05 - mvliet

Line: 1 to 1
 
META TOPICPARENT name="UvicKVMResources"
Added:
>
>
 
Changed:
<
<
Empty for now.
>
>
First off, you will want to build images on a KVM capable machine. If not, you will be missing out on the hardware acceleration and your install will take forever!

virt-install

This is a command line tool written in python that will allow you to specify the layout of a guest, and do an installation of that guest.

Since the man page for this program contains most information you would want to know, I will keep this section short with just an example and a few quick notes.

This example will create a 10GB disk image and start the installation from an iso located at /home/bob/sl52DVD.iso. The guest is given 512MB of memory, and it will use br0 for its network connection.

virt-install --connect qemu:///system
             --name sl52base \
             --ram 512 \
             --file /opt/workspace/images/sl52base \
             --file-size 10 \
             --network BRIDGE:br0 \
             --accelerate \
             --os linux \
             --os-variant rhel5 \
             --cdrom /home/bob/sl52DVD.iso

NOTES:

  • When creating a KVM guest you must always use the --accelerate option. If you do not, it will fall back to QEMU emulation.
  • the --cdrom option can point to an actual drive (ie, /dev/hdc), or a iso file on your local machine, or even a remote file (ftp, http, etc.).
  • ram is specified in MB, disk size is specified in GB.
  • the --disk option may be of more use to you the --file.

virt-manager

One of the features of virt-manager is the ability to create new guests by using a nice GUI. There are some features you will not have access to with this approach, but the majority of features you need will be there.

virt-clone

This is another command line program that will take an existing guest image and create a copy of it. Assignment of new UUIDs and network MACs is easily handeled here.
 
Deleted:
<
<
Will include building images with virt-install, and virt-manager.
 

-- MattVliet - 04 Mar 2009 \ No newline at end of file

Revision 12009-03-05 - mvliet

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="UvicKVMResources"

Empty for now.

Will include building images with virt-install, and virt-manager.

-- MattVliet - 04 Mar 2009

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback