KickStart+DHCP+NFS+TFTP+PXE网络无人值守安装RedHatEnterpriseLinux5.5LabGuide一、什么是PXE..........................................................................................................................................1二、KickStart+DHCP+NFS+TFTP+PXE的工作原理......................................................................1三、架设Linux网络安装服务器..............................................................................................................11.关闭iptables与SElinux....................................................................................................................12.搭建YUM方便后续的软件安装........................................................................................................13.DHCP的查看、安装与配置..............................................................................................................34.TFTP的安装与配置............................................................................................................................45.PXE的配置(bootstrap)...............................................................................................................86.NFS的安装与配置.............................................................................................................................97.配置kickstart...................................................................................................................................108.编辑ks.cfg........................................................................................................................................189.网络安装系统前检查........................................................................................................................22四、测试全自动网络安装Linux.............................................................................................................221首先修改客户端BIOS,使其首先从网络启动,...........................................................................222.自动搜索dhcp服务,获取ip,读取default这个文件.................................................................233.后续系统安装过程会自动进行,大概10分钟左右安装完成会重启...........................................23五、附录....................................................................................................................................................241.实验中遇到的问题............................................................................................................................242.拓扑图................................................................................................................................................263.实验环境............................................................................................................................................261|26KickStart+DHCP+NFS+TFTP+PXE网络无人值守安装RHEL5.5一、什么是PXEPXE(prebootexecuteenvironment)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站通过网络从远端服务器下载映像,并由此支持来自网络的操作系统的启动过程,其启动过程中,终端要求服务器分配IP地址,再用TFTP(trivialfiletransferprotocol)或MTFTP(multicasttrivialfiletransferprotocol)协议下载一个启动软件包到本机内存中并执行,由这个启动软件包完成终端基本软件设置,从而引导预先安装在服务器中的终端操作系统。PXE可以引导多种操作系统,如:Windows95/98/2000/xp/2003/vista/2008,linux等二、KickStart+DHCP+NFS+TFTP+PXE的工作原理无光软驱服务器通过PXE网卡启动,从dhcp服务器获取IP,通过tftp下载pxelinux.0文件找到pxelinux.cfg里的配置文件,按配置文件找着vmlinuz引导RHEL5.5进入安装界面,之后选择NFS方式安装系统三、架设Linux网络安装服务器1.关闭iptables与SElinux[root@localhost/]#chkconfigiptablesoff;serviceiptablesstop[root@localhost/]#setenforce02.搭建YUM方便后续的软件安装Yum(全称为YellowdogUpdater,Modified)是一个在Fedora和RedHat以及SUSE、CentOS中的Shell前端软件包管理器。基於RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。2.1创建一个目录,并把系统安装光盘内容全部复制到该文件夹内[root@localhost/]#mkdir/install2.2安装工具包[root@localhost/]#rpm-ivh/install/Server/createrepo-0.4.11-3.el5.noarch.rpm2.3生成仓库数据库:[root@localhost/]#cd/install2|26[root@localhostinstall]#createrepo.2.4查看文件[root@localhost/]#ls/install/repodata/注:filelists.xml.gzother.xml.gzprimary.xml.gz//这三个文件为软件包列表文件。repomd.xml//这个文件为MD5校验信息2.5客户端配置[root@localhost~]#cd/etc/yum.repos.d[root@localhostyum.repos.d]#lsrhel-debuginfo.repo[root@localhostyum.repos.d]#cprhel-debuginfo.reposhenyang.repo[root@localhostyum.repos.d]#vishenyang.repo[root@localhostyum.repos.d]#moreshenyang.repo[rhel-shenyang]//[]内的是仓库的名字name=shenyang//name是仓库的描述也可以说是名字baseurl=file:///install//baseurl仓库的位置,/install是光盘文件所在的共享目录enabled=1//enabled是否启用这个仓库,1为起用,0为禁用gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release3|262.6清除yum安装时的缓存[root@localhost~]#yumcleanall3.DHCP的查看、安装与配置3.1查看DHCP是否安装[root@localhost~]#rpm-qa|grepdhcp*3.2安装DHCP[root@localhost~]#rpm-ivh/install/Server/dhcp-3.0.5-23.el5.x86_64.rpm3.3配置DHCP服务器(配置文件:/etc/dhcpd.conf)[root@localhost~]#cp/usr/share/doc/dhcp-3.0.5//dhcpd.conf.sample/etc/dhcpd.conf[root@localhost~]#vi/etc/dhcpd.confddns-update-styleinterim;ignoreclient-updates;allowbooting;//定义能够PXE启动allowbootp;//定义支持bootpnext-server192.168.1.137;//tftp服务器ip地址,告诉客户端在获取到pxelinux.0文件之后去哪里获取其余的启动文件4|26filenamepxelinux.0;//pxe启动文件位置,注意此行的位置,写在subnet下面的话会失败subnet192.168.1.0netmask255.255.255.0{//在192.168.1.0/24位网络中使用dhcpoptionrouters192.168.1.1;//默认网关optionsubnet-mask255.255.255.0;//子网掩码rangedynamic-bootp192