1、配置yum源,安装dhcp服务
cat /etc/yum.repos.d/my-source.repo
[my-source]
name=Red Hat Enterprise Linux $releasever - $basearch - my source
baseurl=file:///media
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RedHat-release
Mount /dev/cdroom /media
Yum –y instasll dhcp
yes | find / -name dhcpd.conf.sample –exec cp -p {} /etc/dhcp/dhcpd.conf \;
过滤注释行:grep -v ^# < /etc/dhcp/dhcpd.conf
编辑dhcpd.conf 添加以下内容:
ddns-update-style interim;
ignore client-updates;
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.124;
option subnet-mask 255.255.255.0;
next-server 192.168.1.124;
filename "pxelinux.0";
range 192.168.1.200 192.168.1.220;
default-lease-time 600;
max-lease-time 7200;
}
启动dhcp服务:
/etc/init.d/dhcpd start
Starting dhcpd: [ OK ]
2、安装tftp服务
yum search tftp ; yum -y install tftp-server
chkconfig tftp on; /etc/init.d/xinetd restart
测试tftp: tftp 192.168.1.124
tftp> get filename
3、部署安装源
Yum –y install nfs*;/etc/init.d/rpcbind start
echo "/media *(sync,ro)" >> /etc/exports; /etc/init.d/nfs star
查看共享信息:
exportfs -v
测试挂载:
mount.nfs 192.168.1.124:/media/ /opt/test
使用ftp的源:启动vsftp;mount /dev/cdroot /var/ftp/pub/linuxos;
4、部署PXE环境
获取Pxelinux.0文件需要安装pxelinux包
yum search pxelinux;yum –y install yum search pxelinux
mkdir /var/lib/tftpboot/pxelinux.cfg
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
cp /media/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/
cp /media/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
修改后的default文件:
default linux
prompt 1
timeout 10
display boot.msg
menu background splash.jpg
menu title Welcome to Red Hat Enterprise Linux 6.1!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000
label linux
menu label ^Install or upgrade an existing system
menu default
kernel vmlinuz
append initrd=initrd.img ks=ftp://192.168.1.124/pub/ksfile/ks.cfg
5、配置ks.cfg文件
yum -y install system-config-kickstart
运行system-config-kickstart
system-config-kickstart
Basic Configuration :
选择时区、不使用UTC clock、设置root密码Encrypt root password、体系结构x86
选择安装后重启系统
Installation Method
执行新安装、配置安装源:
方式一:FTP Server: 192.168.1.124 FTP Directory: /pub/linuxos
方式二:NFS Server:192.168.1.124 NFS Directory: /media
Boot Loader Options
默认即可、设置GRUB口令
Partition Information
清除主引导记录、删除所有现存分区、初始化磁盘标签、布局分区
最小安装包选项:
@core
@server-policy
6、准备安装
将ks.cfg放置/var/ftp/pub/ksfile/目录下,安装源挂载至/var/ftp/pub/linuxos目录下。
lftp 192.168.1.124确认都可匿名访问即可(关闭selinux与防火墙)。
7、测试安装
在同一交换网络下,启动待安装系统电源,开始安装。
附:ks.cfg
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url="ftp://192.168.1.124/pub/linuxos"
# Root password
rootpw --iscrypted $1$IHU6BRQq$vzef6noxmHubY.gMcAacq0
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --enforcing
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone Africa/Abidjan
# Network information
network --bootproto=static --device=eth0 --gateway=192.168.1.1 --ip=192.168.1.133 --nameserver=61.234.145.102 --netmask=255.255.255.0 --onboot=on
# System bootloader configuration
bootloader --location=mbr --md5pass="$1$uDPJOfxO$G.EQYfN0kfQnV5ToHmiQa1"
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype="ext4" --size=100
part / --fstype="ext4" --size=1024
part /usr --fstype="ext4" --size=4096
part swap --fstype="swap" --size=1024
part /var --fstype="ext4" --size=2048
%packages
#@base
@core
@server-policy
#@chinese-support
%end