说明:当批量给主机安装操作系统时,我们不可能用传统的方式用光盘、U盘等,一台一台逐个安装,这样一来,费时又力,对于批量" />

Pxe+Kickstart批量网络安装操作系统

本文发布时间: 2019-Mar-22
Pxe+Kickstart实现无人值守批量网络安装操作系统QTkc=" />说明:当批量给主机安装操作系统时,我们不可能用传统的方式——用光盘、U盘等,一台一台逐个安装,这样一来,费时又力,对于批量部署主机时,效率是极低的。所以,我们通过Pxe+Kickstart技术来实现企业中集群服务的批量安装,近而将网络技术人员从繁忙中解脱出来,之后你就可以去悠闲地去饮一杯coffee了,过半个多小时回来,这批服务器都乘乘地拥有了自己的操作系统。下面是详细配置过程:实验环境准备VmwareworkStation虚拟机一台装有Linux操作系统的虚拟机,这里命名它为PXE-Server(静态IP为192.168.1.254)新建2台虚拟裸机(待安装的所有裸机网卡都配置成vmnet1)实验过程概述PXE-Server上安装dhcpd、tftp、nfs、httpd三个服务将相关内核和启动引导文件initrd.imgpxelinux.0pxelinux.cfgvmlinuz放到tftp根目录/tftpboot下步骤:1.配置yum库[root@localhost~]#cd/etc/yum.repos.d[[email protected]]#cprhel-debuginfo.repoyang.repo[[email protected]]#vimyang.repo[rhel-server]//[]里要以rhel-开头,制作kickstart文件选择安装包时要用到name=RedHatEnterpriseLinuxServerbaseurl=file:///misc/cd/Serverenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release测试yum库安装情况[root@localhost~]#yumlistLoadedplugins:product-id,security,subscription-managerThissystemisnotregisteredtoRedHatSubscriptionManagement.Youcanusesubscription-managertoregister.InstalledPackagesDeployment_Guide-en-US.noarch5.8-1.el5installedDeployment_Guide-zh-CN.noarch5.8-1.el5installedDeployment_Guide-zh-TW.noarch5.8-1.el5installedGConf2.i3862.14.0-9.el5installed..出现上边的界面表示yum库安装成功!2.安装并配置DHCP服务[root@localhost~]#yum-yinstalldhcp*//安装[root@localhost~]#vim/etc/dhcpd.conf//配置ddns-update-styleinterim;next-server192.168.1.254;//filename"pxelinux.0";subnet192.168.1.0netmask255.255.255.0{optionsubnet-mask255.255.255.0;optiondomain-name"tarena.com";optiondomain-name-servers192.168.1.254;rangedynamic-bootp192.168.1.1192.168.1.10;default-lease-time21600;max-lease-time43200;}3.安装NFS共享服务[root@localhost~]#yum-yinstallnfs-utilsportmap//安装软件包nfs-utils-1.0.9-66.el5portmap-4.0-65.2.2.1[root@localhost~]#vim/etc/exports//修改主配置文件/data/iso/rhel5.9*(ro)[root@localhost~]#mkdir-p/data/iso/rhel5.9//创建系统镜像存放目录[root@localhost~]#cp-rf/misc/cd/*/data/iso/rhel5.9//拷贝光盘所有也可以用挂载的方法,同样实现访问镜像文件的作用[root@localhost~]#umount-a[root@localhost~]#mount/misc/cd/data/iso/rhel5.93.安装并配置TFTP服务[root@localhost~]#yum-yinstalltftp[root@localhost~]#servicexinetdrestart//开启tftp临时服务[root@localhost~]#cd/misc/cd/images/pxeboot//进入光盘目录[root@localhostpxeboot]#lsinitrd.imgREADMETRANS.TBLvmlinuz[root@localhostpxeboot]#cpinitrd.imgvmlinuz/tftpboot[root@localhost~]#vim/etc/xinetd.d/tftp//配置tftp临时服务文件[root@localhost~]#find/-namepxelinux.0//查找pxelinux.0文件存位置/tftpboot/linux-install/pxelinux.0/usr/share/syslinux/pxelinux.0[root@localhost~]#cp/tftpboot/linux-install/pxelinux.0/tftpboot//将这个文件拷贝到/tftpboot若没找到/pxelinux.0这个文件,则安装一个包:[root@localhost~]#yum–yinstallsyslinux-tftpboot.x86_64安装完后到这个位置去找/usr/share/syslinux/pxelinux.0[root@localhost~]#cp-rf/tftpboot/linux-install/pxelinux.cfg//tftpboot//将pxelinux.cfg拷贝到/tftpboot若找不到则创建这目录[root@localhostpxeboot]#mkdir/tftpboot/pxelinux.cfg然后[root@localhostpxeboot]#cp/misc/cd/isolinux/isolinux.cfg\>/tftpboot/pxelinux.cfg/default//拷贝模板到default[root@localhost~]#cd/tftpboot/[root@localhosttftpboot]#lsinitrd.imglinux-installpxelinux.0pxelinux.cfgvmlinuz至此/tftpboot下的initrd.imgpxelinux.0pxelinux.cfgvmliuz全部准备好了4.生成Kickstart无人值守配置文件[root@localhost~]#yum-yinstallsystem-config-kickstart//安装生成Kickstart的工具QTzdUeWlUSEFBR1VyXzBKbGcwMDA1LnBuZw==" src="http:///uploadfile/files/2014/0422/2014042208413759.png" title="捕获在.PNG" />之后,点击文件保存到一个目录下就OK了5.安装httpd服务[root@localhost~]#yum-yinstallhttpd[root@localhost~]#cp/root/ks.cfg/var/www/html///ks.cfg是步骤4生成的配置文件,/var/www/html/——httpd默认站点[root@localhost~]#servicehttpdrestart[root@localhost~]#chkconfighttpdon[root@localhost~]#vim/var/www/html/ks.cfg在文件中添加key--skip//任意位置最后vim/tftpboot/pxelinux.cfg/default6.测试将两台虚拟裸机开机(此后不应有交互的操作,静等安装)


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:10pm
栏目列表