Oracle enterprise linux6.2 kickstart无人值守安装
相信大家都已经多少了解kickstart的原理,下面就直接开始相关配置步骤:
注意:kickstart服务器要关闭Iptables防火墙及Selinux服务!!!
1、挂载系统安装光盘到Kickstart服务器及建立项目服务目录:
[root@localhost ~]# mkdir /kickstart //应答文件存放目录
[root@localhost ~]# mkdir /iso //Oracle Enterprise Linux 6.2镜像文件挂载目录
[root@localhost ~]# mkdir /tftpboot //tftp目录存放启动文件
[root@localhost ~]# mkdir /tftpboot/pxelinux.cfg //存放启动文件
[root@localhost /]# mount /dev/sr0 /iso //挂载Oracle Enterprise Linux 6.2镜像
[root@localhost /]# vim /etc/fstab //设置开机自动挂载Oracle Enterprise Linux 6.2镜像文件
......
/dev/sr0 /iso iso9660 defaults 0 0
.....
2、设置yum仓库源:
[root@localhost ~]# vim /etc/yum.repos.d/kickstart.repo
......
[kickstart]
name=Oracle enterprise linux6.2 - Media
baseurl=file:///iso
gpgcheck=0
enabled=1
......
3、安装Kickstart需要的组件
[root@localhost ~]# yum install nfs* dhcp tftp* system-config-kickstart –y
4、设置nfs
[root@localhost ~]# vim /etc/exports //该文件为空文件,直接输入以下三行即可。
......
/iso *(ro,sync)
/kickstart *(ro,sync)
/tftpboot *(ro,sync)
......
[root@localhost /]# exportfs -rv
exporting *:/iso
exporting *:/kickstart
exporting *:/tftpboot
5、设置tftp
[root@localhost /]# vim /etc/xinetd.d/tftp
......
disable = no(yes改成no)
server_args = -s /tftpboot (修改成自己定义的tftp目录)
......
6、配置DHCP
[root@localhost ~]# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcpd.conf
[root@localhost ~]# vim /etc/dhcpd.conf
......
allow booting;
allow bootp;
option routers 192.168.4.1;
option subnet-mask 255.255.255.0;
max-lease-time 43200;
next-server 192.168.4.1;
......
7、配置ks.cfg文件
#platform=x86, AMD64, 或 Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Use graphical install
graphical
# Firewall configuration
firewall --enabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Installation logging level
logging --level=info
# Use NFS installation media
nfs --server=192.168.4.1 --dir=/iso
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# Reboot after installation
reboot
#Root password 这一步注意要使用system-config-kickstart工具设置系统root的密码改变选择了加密!!!
rootpw --iscrypted $1$9G/AkkmG$NtrFgqOQ4nAP.EUMXmxTP0
# SELinux configuration
selinux --enforcing
# Do not configure the X Window System
skipx
# System timezone
timezone Asia/Shanghai
# Install OS instead of upgrade
install
# Disk partitioning information
part / --fstype="ext4" --size=7800
part /boot --fstype="ext4" --size=200
part swap --fstype="swap" --size=2048
%packages
8、配置支持pxe启动
[root@localhost ~]# cp ks.cfg /kickstart/
[root@localhost ~]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
[root@localhost ~]# cp /iso/images/pxeboot/vmlinuz /tftpboot/
[root@localhost ~]# cp /iso/images/pxeboot/initrd.img /tftpboot/
[root@localhost ~]# cp /iso/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
[root@localhost ~]# chmod a+r /tftpboot/pxelinux.cfg/default
[root@localhost ~]# vim /tftpboot/pxelinux.cfg/default
default linux
prompt 1
timeout 60
display boot.msg
label linux
kernel vmlinuz
append ks=nfs:192.168.4.1://kickstart/ks.cfg initrd=initrd.img
label text
kernel vmlinuz
append initrd=initrd.img text
label ks
kernel vmlinuz
append ks initrd=initrd.img
label local
localboot 1
label memtest86
kernel memtest
append -
9、启动服务
[root@localhost /]# service dhcpd restart
[root@localhost /]# chkconfig dhcpd on
[root@localhost /]# service nfs restart
[root@localhost /]# chkconfig nfs on
[root@localhost /]# service xinetd restart
[root@localhost /]# chkconfig xinetd on
10、测试kickstart自动化安装: