This article creates a PXEServer in a Virtual Machine (Ubuntu11.04server), and then installs a Virtual Machine (Ubuntu11.04Server) through PXE in KVM ). both VMS are clearly in the same LAN. because PXE virtual bare metal needs to use DHCP protocol to find PXEserver IP Address at startup, so cross-lan PXE installation requires DHCP relay. This is not covered in this article. For details, refer: cross-LAN system self-built PXE
This article builds a PXE server in a Virtual Machine (Ubuntu 11.04 Server), and then installs a Virtual Machine (Ubuntu 11.04 Server) through PXE in KVM. Both virtual machines are obviously in the same LAN.
Because PXE virtual bare metal needs to use DHCP protocol to find PXE server IP Address at startup, so cross-lan PXE installation requires DHCP relay. This is not covered in this article. For details, refer: automatic Installation http://www.linuxidc.com/Linux/2012-07/65146.htm for PXE cross-Lan Systems
1.1 dnsmasq
Apt-get install dnsmasq
Vim/etc/dnsmasq. conf
Bogus-priv
Filterwin2k
Interface = eth0
Dhcp-range = 192.168.100.172, 192.168.100.180, 12 h
Dhcp-host = 52: 54: 00: ed: 00: f7, 192.168.100.178
Dhcp-boot = pxelinux.0
Enable-tftp
Tftp-root =/var/ftpd
Dhcp-authoritative
/Etc/init. d/dnsmasq restart
Note: If you want to assign a fixed IP address to the pxe client, you can use the dhcp-host parameter. The advantage of this method is that you can avoid messing up the IP address of the network.
If you use the Virtual Machine Provided by KVM as the pxe client for testing, you should create a new virtual machine each time you test (do not repeat the test ).
1.2 PXE
Mkdir/var/www/ubuntu
Mount-o loop/bak // kvmimages/ubuntu-11.10-server-amd64.iso/mnt
Cp/mnt/preseed/ubuntu-server.seed/var/www/ubuntu
Cp-a/mnt/*/var/www/ubuntu
Cp-r/mnt/install/netboot/*/var/ftpd/
Vim/var/ftpd/pxelinux. cfg/default
Default linux
Label linux
Kernel ubuntu-installer/amd64/linux
Append ks = http: // 192.168.100.171/ubuntu/ks. cfg preseed/url = http: // 192.168.100.171/ubuntu/ubuntu-server.seed vga = normal initrd = ubuntu-installer/amd64/initrd.gz --
Note that the preceding ks and preseed should be configured with a Web server pointing to the/var/www/ubuntu directory.
1.3 Apache
Apt-get install apache2
Vi/etc/apache2/sites-available/default
ServerName ubuntu
DocumentRoot/var/www/ubuntu
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow, deny
ErrorLog/var/log/apache2/error-ubuntu.log
Sudo ln-s/etc/apache2/sites-available/default/etc/apache2/sites-enabled/ubuntu
/Etc/init. d/apache2restart