PXE与Kickstart无人值守安装Linux
- Using NAT connection mode
- ifconfig eth0 172.16.100.10
- setenforce 0
- service iptables stop
- yum install -y syslinux tftp-server tftp dhcp
- cp /usr/share/syslinux/{pxelinux.0,chain.c32,menu.c32,mboot.c32,memdisk} /var/lib/tftpboot/
- cp /usr/share/doc/dhcp*/dhcpd.conf.example /etc/dhcp/dhcpd.conf
- cd /etc/dhcp/dhcpd.conf
- vim dhcpd.conf
# 在第一次出现subnet的那一行之前添加
subnet 172,16.0.0. netmask 255.255.0.0 {
range 172.16.1.1 172.16.100.253;
filename "pxelinux.0"; # 指明要从tftp服务器上获取哪个文件
next-server 172.16.100.10; # 指明tftp服务器的ip地址
}
- cd /var/lib/tftpboot/pxelinux.cfg
- vim default
- i
default menu.c32
promt 3
timeout 10
menu title CentOS6Installation
label Linux
menu label CentOS6
kernel vmlinuz
append initrd=initrd.img repo=http://192.168.1.1/centos6repo/ ks=http://192.168.1.1/ks.cfg
- :wq
- vim /etc/xinetd/tftp --> disable = no
- mkdir /var/lib/tftpboot/pxelinux.cfg
- mkdir /media/cdrom
- mount /dev/sr0 /media/cdrom
- cp /media/cdrom/images/{vmliuz,initrd.img} /var/lib/tftpboot/
- service xinetd start
- umount /dev/sr0
- yum install httpd
- service httpd start
- cd /var/www/html/
- mkdir centos6repo
- mount /dev/sr0 centos6repo
- create a new Virtual Machine
- select start from NIC
- boot your machine
- hit return button on your keyboard
- you need do nothing, just look or do something else