使用PXE需要kickstart,(ftp,HTTP,nfs中的一项),tftp,DHCP,CentOS 6.4系统光盘
1)ks.cfg文件制作
[root@www share]# yum install -y system-config-kickstart
kickstart 基于 /root/anaconda-ks.cfg(本系统安装时配置的磁盘分配,时区,语言,选择的rpm包等参数)制作ks.cfg
# Partition clearing information 复制anaconda-ks.cfg中分区信息
clearpart –all –initlabel
part /boot –fstype=ext4 –size=500
part pv.008002 –grow –size=1
volgroup vg_centos –pesize=4096 pv.008002
logvol / –fstype=ext4 –name=lv_root –vgname=vg_centos –grow –size=1024 –maxsize=51200
logvol swap –name=lv_swap –vgname=vg_centos –grow –size=1984 –maxsize=1984
添加软件包
%packages
@base
@basic-desktop
@core
@debugging
@desktop-debugging
@desktop-platform
@Desktop Platform Development
@Server Platform Development
@Development tools 开发工具编译安装要用的包组
@directory-client
@fonts
@input-methods
@internet-browser
@Java-platform
@legacy-x
@network-file-system-client
@print-client
@remote-desktop-clients
@server-platform
@server-policy
@x11
%end
2)搭建ftp服务器准备RPM软件包
[root@www ~]# yum install -y vsftpd
[root@www ftp]#mkdir CentOS_6.4_x86_64
[root@www ftp]# mount -r /dev/sr0 /var/ftp/CentOS_6.4_x86_64
[root@www ~]# cp ks.cfg /var/ftp/kickstart/ks.cfg
3)准备Centos6.4引导文件这是关键部分(TFTP)
安装并启动tftp
[root@www ~]# rpm -ivh tftp-0.49-7.el6.x86_64.rpm
Preparing… ########################################### [100%]
1:tftp ########################################### [100%]
[root@www ~]# rpm -ivh tftp-server-0.49-7.el6.x86_64.rpm
Preparing… ########################################### [100%]
1:tftp-server ########################################### [100%]
[root@www ~]# chkconfig tftp on
[root@www ~]# service xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
[root@www ~]# ss -uan | grep 69
UNCONN 0 0 *:69 *:*
启动文件及kernel准备
[root@www ~]# yum istall -y syslinux 此软件包准备pxelinux.0用于引导网络安装Linux
[root@www ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
[root@www ~]# cp /var/ftp/CentOS_6.4_x86_64/isolinux/{boot.msg,splash.jpg,vesamenu.c32} /var/lib/tftpboot/ 定义CentOS 6.4默认安装界面
[root@www ~]# cp /var/ftp/CentOS_6.4_x86_64/images/pxeboot/{initrd.img,vmlinuz} /var/lib/tftpboot/
[root@www tftpboot]# mkdir pxelinux.cfg
[root@www pxelinux.cfg]# cp /var/ftp/CentOS_6.4_x86_64/isolinux/isolinux.cfg ./default
label linux
menu label ^Install or upgrade an existing system
menu default
kernel vmlinuz
append initrd=initrd.img ks=
[root@www tftpboot]# ls -lR 验证tftp上文件是否准备完毕
.:
total 36032
-r–r–r– 1 root root 84 Nov 14 03:48 boot.msg
-r–r–r– 1 root root 32495283 Nov 14 03:49 initrd.img
-rw-r–r– 1 root root 26595 Nov 14 03:42 pxelinux.0
drwxr-xr-x 2 root root 4096 Nov 15 01:58 pxelinux.cfg
-r–r–r– 1 root root 151230 Nov 14 03:48 splash.jpg
-r–r–r– 1 root root 162860 Nov 14 03:48 vesamenu.c32
-r-xr-xr-x 1 root root 4043888 Nov 14 03:49 vmlinuz
./pxelinux.cfg:
total 4
-rw-r–r– 1 root root 991 Nov 14 04:01 default
4)DHCP服务器安装
[root@www ~]# rpm -ivh dhcp-common-4.1.1-38.P1.el6.centos.x86_64.rpm
Preparing… ########################################### [100%]
1:dhcp-common ########################################### [100%]
[root@www ~]# rpm -ivh dhcp-4.1.1-38.P1.el6.centos.x86_64.rpm
Preparing… ########################################### [100%]
1:dhcp ########################################### [100%]
[root@www ~]# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.200 192.168.1.225;
option routers 192.168.1.1;
}
next-server 192.168.1.150; 指定tftp用于引导安装
filename=”pxelinux,0″;
[root@www ~]# service dhcpd start
Starting dhcpd: [ OK ]
5)Client准备调整BIOS启动顺序
Client从DHCP获取IP地址
安装界面展示
创建LVM卷
推荐阅读
- 在RHEL/CentOS 7中为多种Linux发行版安装PXE网络启动服务器 http://www.linuxidc.com/Linux/2015-02/113587.htm
- 利用Kickstart实现无人值守安装RHEL6.0系统 http://www.linuxidc.com/Linux/2013-09/89765.htm
- SUSE Linux 11 pxe+DHCP+tftp+ftp 无人值守安装 http://www.linuxidc.com/Linux/2013-06/85481.htm
- 自建DHCP TFTP服务 用PXE启动实现无人值守安装CentOS6 http://www.linuxidc.com/Linux/2014-07/104881.htm
- 使用PXE+DHCP+Apache+Kickstart无人值守安装CentOS5.8 x86_64 http://www.linuxidc.com/Linux/2012-12/76913.htm
- Kickstart 全自动化安装 CentOS 6.3 http://www.linuxidc.com/Linux/2012-12/75570.htm
- Kickstart 自动化安装Linux笔记 http://www.linuxidc.com/Linux/2012-11/73853.htm
- PXE/Kickstart实现远程自动安装RedHat Linux http://www.linuxidc.com/Linux/2012-11/73361.htm
更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14
本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-08/122184.htm