unix:virtualization:kvm:server
                Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| unix:virtualization:kvm:server [2020/10/31 02:29] – rodolico | unix:virtualization:kvm:server [2024/03/30 00:04] (current) – rodolico | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== libvirt | 
| **This is a work in progress, 20201015** | **This is a work in progress, 20201015** | ||
| Line 17: | Line 17: | ||
| You should see either vmx or svm in the output. | You should see either vmx or svm in the output. | ||
| - | Now, install the basic packages needed, a couple of utilities, but not all the extra crud. | + | Now, install the basic packages needed, a couple of utilities, but not all the extra crud. // | 
| <code bash> | <code bash> | ||
| - | apt install -y --no-install-recommends qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils libguestfs-tools genisoimage virtinst libosinfo-bin virt-top | + | apt install -y --no-install-recommends qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils libguestfs-tools genisoimage virtinst libosinfo-bin virt-top | 
| reboot # brings libraries online | reboot # brings libraries online | ||
| </ | </ | ||
| Line 174: | Line 174: | ||
| I'm lazy, so I just created all three, then imported them all at one time. | I'm lazy, so I just created all three, then imported them all at one time. | ||
| - | < | + | < | 
| - | < | + | #! /usr/bin/env bash | 
| - | < | + | |
| - | <forward mode=" | + | |
| - | <bridge name=" | + | |
| - | </ | + | |
| - | </ | + | |
| - | < | + | # create the xml definitions. The br is prepended. | 
| - | < | + | # Add/remove interfaces if needed | 
| - | < | + | for interface in wan lan dmz | 
| - | <forward mode=" | + | do | 
| - | <bridge name="br_dmz"/> | + | cat << EOF > br_$interface.xml | 
| - | </ | + |  | 
| - | </ | + |  | 
| + |  | ||
| + |  | ||
| + |  | ||
| + | EOF | ||
| + | done | ||
| + | # uncomment this if you want to view your xml files but | ||
| + | # not process them | ||
| + | # exit | ||
| - | <code xml br_lan.xml> | ||
| - | < | ||
| - | < | ||
| - | <forward mode=" | ||
| - | <bridge name=" | ||
| - | </ | ||
| - | </ | ||
| - | And imported them all at once. | + | # find all xml files and do the net-define | 
| + | for interface in `ls *.xml` | ||
| + | do | ||
| + | virsh net-define --file $interface | ||
| + | done | ||
| - | <code bash> | + | # since the bridge name is followed by xml, simply remove that | 
| - | for interface in `ls *.xml` ; do virsh net-define --file $interface ; done | + | # and set to autostart and start it | 
| - | for interface in `ls *.xml | cut -d' | + | for interface in `ls *.xml | cut -d' | 
| + | do | ||
| + | virsh net-autostart $interface | ||
| + | virsh net-start $interface | ||
| + | done | ||
| + | # show me the list of network names | ||
| virsh net-list | virsh net-list | ||
| </ | </ | ||
| - | After the last command, you should see your three interfaces defined. That means you can now use them. | + | This script assumes your network names are of the form br_// | 
| + | |||
| + | The last loop assumes there are no periods in the network name. Be warned. | ||
| ===== Using Storage ===== | ===== Using Storage ===== | ||
| Line 236: | Line 243: | ||
| <code bash> | <code bash> | ||
| - | virt-install | + | virt-install \ | 
| - |  | + | --hvm \ | 
|  |  | ||
| - |  | + |  | 
| - |  | + |  | 
| - |  | + |  | 
| - |  | + |  | 
| - |  | + |  | 
| - |  | + |  | 
|  |  | ||
| - |  | + |  | 
|  |  | ||
| - |  | + |  | 
| - |  | + |  | 
| - |  | + |  | 
| - |  | + |  | 
| </ | </ | ||
unix/virtualization/kvm/server.1604129362.txt.gz · Last modified: 2020/10/31 02:29 by rodolico
                
                