Provision KVM VM without DHCP » History » Version 5
Leos Stejskal, 10/15/2021 11:38 AM
1 | 2 | Trey Dockendorf | {{toc}} |
---|---|---|---|
2 | |||
3 | 1 | Trey Dockendorf | h1. Provision KVM VM without DHCP |
4 | |||
5 | This method is similar to the [[gPXE]] provisioning method, but the parameters are passed as kernel boot options. |
||
6 | |||
7 | h2. Prerequisites |
||
8 | |||
9 | In order to use direct kernel booting, the *vmlinuz* and *initrd.img* files need to exist in a storage pool. |
||
10 | |||
11 | I downloaded the two available for CentOS 6.0. |
||
12 | |||
13 | <pre> |
||
14 | cd /var/lib/libvirt/images |
||
15 | wget http://mirror.centos.org/centos/6/os/x86_64/isolinux/vmlinuz |
||
16 | wget http://mirror.centos.org/centos/6/os/x86_64/isolinux/initrd.img |
||
17 | </pre> |
||
18 | |||
19 | h2. Using virt-manager |
||
20 | |||
21 | From within the virtual machine's details, select the *Boot Options*. Expand *Direct kernel boot* and enter the following information. Replace the IP addresses with those specific to your setup |
||
22 | |||
23 | *Kernel path*: /var/lib/libvirt/images/vmlinuz |
||
24 | *Initrd path*: /var/lib/libvirt/images/initrd.img |
||
25 | *Kernel arguments*: ks=http://foremanserver.tld/unattended/provision?static=yes ksdevice=bootif network kssendmac ip=192.168.1.2 netmask=255.255.255.0 gateway=192.168.1.1 dns=192.168.1.1 |
||
26 | |||
27 | h2. command line using virsh |
||
28 | |||
29 | To make these changes edit the virtual machine's XML file through virsh |
||
30 | |||
31 | <pre> |
||
32 | virsh edit domain |
||
33 | </pre> |
||
34 | |||
35 | Below are the relevant lines, replace the IPs with those of your setup |
||
36 | |||
37 | 4 | Andreas Ntaflos | <pre><code> |
38 | 1 | Trey Dockendorf | <os> |
39 | <type arch='x86_64' machine='rhel6.0.0'>hvm</type> |
||
40 | <kernel>/var/lib/libvirt/images/vmlinuz</kernel> |
||
41 | <initrd>/var/lib/libvirt/images/initrd.img</initrd> |
||
42 | <cmdline>ks=http://foremanserver.tld/unattended/provision?static=yes ksdevice=bootif network kssendmac ip=192.168.1.2 netmask=255.255.255.0 gateway=192.168.1.1 dns=192.168.1.1</cmdline> |
||
43 | <boot dev='hd'/> |
||
44 | 3 | Ohad Levy | </os></code> |
45 | 1 | Trey Dockendorf | </pre> |