Kickstart+http+tftp无人值守化安装RHEL7.2操作系统
- 软件准备
Yum install httpd ftp-server syslinux system-config-kickstart.noarch xinetd.x86_64
- dhcp配置
subnet 10.252.1.0 netmask 255.255.255.0 {
range 10.252.1.100 10.252.1.200;
option domain-name-servers 10.252.1.1;
option domain-name "xingyao.com";
option routers 10.252.1.1;
option broadcast-address 10.252.1.255;
default-lease-time 600;
max-lease-time 7200;
next-server 10.252.1.10;
filename "pxelinux.0";
}
- tftp配置
cat /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
4.cd /var/lib/tftpboot;mkdir pxelinux.cfg
cp /usr/share/syslinux/pxelinux.0 ./.
cp /var/www/html/pakage/images/pxeboot/{vmlinuz,initrd.img} ./.
cp /var/www/html/pakage/isolinux/{vesamenu.c32,boot.msg} ./.
cp /var/www/html/pakage/isolinux/isolinux.cfg pxelinux.cfg/default
- 修改/var/lib/tftpboot/pxelinux.cfg/default
egrep -v "^$|^#" /var/lib/tftpboot/pxelinux.cfg/default
default linux
timeout 600
display boot.msg
menu clear
menu background splash.png
menu title Red Hat Enterprise Linux 7.2
menu vshift 8
menu rows 18
menu margin 8
menu helpmsgrow 15
menu tabmsgrow 13
menu color border * #00000000 #00000000 none
menu color sel 0 #ffffffff #00000000 none
menu color title 0 #ff7ba3d0 #00000000 none
menu color tabmsg 0 #ff3a6496 #00000000 none
menu color unsel 0 #84b8ffff #00000000 none
menu color hotsel 0 #84b8ffff #00000000 none
menu color hotkey 0 #ffffffff #00000000 none
menu color help 0 #ffffffff #00000000 none
menu color scrollbar 0 #ffffffff #ff355594 none
menu color timeout 0 #ffffffff #00000000 none
menu color timeout_msg 0 #ffffffff #00000000 none
menu color cmdmark 0 #84b8ffff #00000000 none
menu color cmdline 0 #ffffffff #00000000 none
menu tabmsg Press Tab for full configuration options on menu items.
menu separator # insert an empty line
menu separator # insert an empty line
label linux
menu label ^Install Red Hat Enterprise Linux 7.2
kernel vmlinuz
append initrd=initrd.img ks=http://10.252.1.10/ks.cfg
label check
menu label Test this ^media & install Red Hat Enterprise Linux 7.2
menu default
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.2\x20Server.x86_64 rd.live.check quiet
menu separator # insert an empty line
menu begin ^Troubleshooting
menu title Troubleshooting
label vesa
menu indent count 5
menu label Install Red Hat Enterprise Linux 7.2 in ^basic graphics mode
text help
Try this option out if you're having trouble installing
Red Hat Enterprise Linux 7.2.
endtext
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.2\x20Server.x86_64 xdriver=vesa nomodeset quiet
label rescue
menu indent count 5
menu label ^Rescue a Red Hat Enterprise Linux system
text help
If the system will not boot, this lets you access files
and edit config files to try to get it booting again.
endtext
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.2\x20Server.x86_64 rescue quiet
label memtest
menu label Run a ^memory test
text help
If your system is having issues, a problem with your
system's memory may be the cause. Use this utility to
see if the memory is working correctly.
endtext
kernel memtest
menu separator # insert an empty line
label local
menu label Boot from ^local drive
localboot 0xffff
menu separator # insert an empty line
menu separator # insert an empty line
label returntomain
menu label Return to ^main menu
menu exit
menu end
- 光盘镜像挂在到http站点下/var/www/html/pakage
生成ks.cfg自动应答文件,如下:(http主机为10.252.1.10,将以下图中192.168.1.120修改掉)
- RHEL7yum源必须如下设置,否则生成ks.cfg文件获取不到软件包
[development] # 名字必须是development
name=rhel7
baseurl=file:///var/www/html/pakage
enabled=1
gpgcheck=0
- 将生成的ks.cfg文件放到/var/www/html/目录下
- 创建一个虚拟机,网卡设置为与10.252.1.10(此处设置vmnet4)同一局域网,开机即可无人值守自动化安装