PXE批量安装操作系统自动化

PXEz自动化

在PXE服务器操作:

*yum -y install dhcp xinetd tftp tftp-server*

*yum -y install system-config-kickstart*

*yum -y install syslinux*

*[root@localhost ks]# cat /etc/dhcp/dhcpd.conf*

*subnet 192.168.7.0 netmask 255.255.255.0 {*

*range 192.168.7.100 192.168.7.200;*

*option domain-name-servers 192.168.7.254;*

*option domain-name "internal.example.org";*

*option routers 192.168.7.2;*

*option broadcast-address 192.168.7.255;*

*default-lease-time 600;*

*max-lease-time 7200;*

*next-server 192.168.7.150;*

*filename "pxelinux.0";*

*}*

*[root@localhost ks]# cat /etc/sysconfig/network-scripts/ifcfg-ens33TYPE=Ethernet*

*PROXY_METHOD=none*

*BROWSER_ONLY=no*

*BOOTPROTO=static*

*DEFROUTE=yes*

*IPV4_FAILURE_FATAL=no*

*IPV6INIT=yes*

*IPV6_AUTOCONF=yes*

*IPV6_DEFROUTE=yes*

*IPV6_FAILURE_FATAL=no*

*IPV6_ADDR_GEN_MODE=stable-privacy*

*NAME=ens33*

*UUID=24d1ccb6-f64f-4a62-a704-64092b8aa6a6*

*DEVICE=ens33*

*ONBOOT=yes*

*IPADDR=192.168.7.150*

*NETMASK=255.255.255.0*

*GATEWAY=192.168.7.2*

*[root@localhost ks]#*

*[root@localhost ks]# cat /etc/yum.repos.d/pxe.repo*

*[development]*

*name=pxe*

*baseurl=http://192.168.7.150/pub*

*enabled=1*

*gpgcheck=0*

*[root@localhost ks]#*

*[root@localhost ~]# cat /etc/xinetd.d/tftp*

*# default: off*

**# description: The tftp server serves files using the trivial file transfer **

*#* **protocol. The tftp protocol is often used to boot diskless **

*#* **workstations, download configuration files to network-aware printers, **

*#* *and to start the installation process for some operating systems.*

*service tftp*

*{*

*socket_type* *= dgram*

*protocol* *= udp*

*wait* *= yes*

*user* *= root*

*server* *= /usr/sbin/in.tftpd*

*server_args* *= -s /var/lib/tftpboot*

*disable* *= no*

*per_source* *= 11*

*cps* *= 100 2*

*flags* *= IPv4*

*}*

*[root@localhost ~]#*

*cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/*

*[root@localhost ks]#cat /var/lib/tftpboot/pxelinux.cfg/default*

*label linux*

*menu label ^Install CentOS 7*

*menu default*

*kernel vmlinuz*

*append initrd=initrd.img ks=http://192.168.7.150/ks/ks123.cfg*

*[root@localhost ks]# history*

*1 systemctl stop firewalld*

*2 iptables -L*

*3 systemctl disable firewalld*

*4 setenforce 0*

*5 vim /etc/selinux/config*

*6 setenforce 0*

*7 cat /etc/sysconfig/network-scripts/ifcfg-ens33*

*8 yum repolist*

*9 vim /etc/resolv.conf*

*10 yum repolist*

*11 yum -y install dhcp xinetd tftp tftp-server*

*12 cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf*

*13 vim /etc/dhcp/dhcpd.conf*

*14 systemctl restart dhcpd*

*15 systemctl enable dhcpd*

*16 vim /etc/xinetd.d/tftp*

*17 systemctl restart xinetd*

*18 systemctl enable xinetd*

*19 yum -y install syslinux*

*20 cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/*

*21 iptables -L*

*22 getenforce*

*23 mkdir /var/lib/tftpboot/pxelinux.cfg*

*24 mount /dev/cdrom /mnt/*

*26 cd /mnt/*

*28 cd /mnt/*

*30 cd isolinux/*

*32 cp isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/*

*33 cp isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default*

*35 cp * /var/lib/tftpboot/*

*36 yum -y install httpd*

*37 systemctl restart httpd*

*38 systemctl enable httpd*

*49 mkdir /var/www/html/pub*

*50 mount /dev/cdrom /var/www/html/pub/*

*51 cd /var/www/html/pub/*

*55 vim /etc/yum.repos.d/pxe.repo*

*56 yum repolist*

*58 system-config-kickstart*

*102 vim /var/lib/tftpboot/pxelinux.cfg/default*

posted @ 2024-03-11 22:56  三思博客  阅读(7)  评论(0编辑  收藏  举报