使用vmware测试PXE批量安装服务器的详细过程

Kickstart的工作原理是在安装过程中记录典型的需要人工干预填写的各种参数,并生成一个名为ks.cfg的文件,本文重点给大家介绍使用vmware测试PXE批量安装服务器的详细过程,需要的朋友参考下吧

使用vmware测试PXE批量安装服务器的详细过程,久久派带你了解更多相关信息。

目录
  • 一、准备阶段
    • 1、准备环境
    • 2、安装方式
    • 3、网卡配置
  • 二、安装阶段
    • 1、安装httpd
    • 2、安装tftp-server
    • 3、复制pxe文件
    • 4、安装dhcp服务
  • 三、安装kickstart自动安装工具
    • 四、在客户主机上测试
      • 五、相关服务

        一、准备阶段

        1、准备环境

        Vmware workstation

        Centos7一台做pxe-server

        地址:192.168.138.5

        子网掩码:255.255.255.0

        网关:192.168.138.2

        关闭selinux和防火墙

        2、安装方式

        Kickstart安装。 Kickstart是一种无人值守的安装方式。它的工作原理是在安装过程中记录典型的需要人工干预填写的各种参数,并生成一个名为ks.cfg的文件。安装程序首先会去查找Kickstart生成的文件,如果找到合适的参数,就采用这些参数;安装程序会根据ks.cfg中的设置重启系统,并结束安装。

        3、网卡配置

        网卡选择hostonly模式,取消hostonly模式的dhcp功能。

        使用vmware测试PXE批量安装服务器的详细过程

        二、安装阶段

        因为后面要用到system-config-kickstart工具生成ks文件,它必须依赖于X Windows,所以我们要提前安装好桌面环境。

        yum-y groupinstall ‘X Window System\’

        yum-y groupinstall ‘GNOME Desktop Environment\’

        1、安装httpd

        需要http的环境存放系统镜像文件和ks文件,所以先安装http

        yum install httpd

        Systemctl start httpd

        访问http://192.168.138.5

        使用vmware测试PXE批量安装服务器的详细过程

        配置yum
        mount /dev/cdrom /mnt
        cd /mnt

        2、安装tftp-server

        yum-y install tftp-server

        修改/etc/xinetd.d/tftp,将disable的值由yes变为no

        使用vmware测试PXE批量安装服务器的详细过程

        service tftp{socket_type = dgramprotocol = udpwait = yesuser = rootserver = /usr/sbin/in.tftpdserver_args = -s /var/lib/tftpbootdisable = noper_source = 11cps = 100 2flags = IPv4}

        重启xinetd进程,若没有xinetd则需要yum安装

        systemctl restart xinetd.service

        新建tftpboot文件夹

        mkdir -p /var/lib/tftpboot

        3、复制pxe文件

        安装syslinux,并复制pxelinux.0文件到/var/lib/tftpboot中

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

        新建/var/www/html/cdrom,并挂载

        Mount /dev/cdrom /var/www/html/cdrom

        yum源配置

        使用vmware测试PXE批量安装服务器的详细过程

        将光盘上的initrd.img和vmlinuxz复制到/var/lib/tftpboot中

        cp /var/www/html/cdrom/images/pxeboot/initrd.img /var/lib/tftpboot
        cp /var/www/html/cdrom/images/pxeboot/vmlinuz /var/lib/tftpboot
        cp /var/www/html/cdrom/isolinux/boot.msg /var/lib/tftpboot

        在tftpboot中新建一个pxelinux.cfg目录

        mkdir pxelinux.cfg

        将cdrom目录中的isolinux.cfg复制到pxelinux.cfg目录中,同时更改文件名称为default
        cp /var/www/html/cdrom/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
        编辑default文件
        配置如下

        default vesamenu.c32
        timeout 6000
        display boot.msg
        #Clear the screen when exiting the menu, instead of leaving the menu displayed.
        #For vesamenu, this means the graphical background is still displayed without
        #the menu itself for as long as the screen remains in graphics mode.
        menu clear
        menu background splash.png
        menu title CentOS 7
        menu vshift 8
        menu rows 18
        menu margin 8
        #menu hidden
        menu helpmsgrow 15
        menu tabmsgrow 13
        #Border Area
        menu color border * #00000000 #00000000 none

        #Selected item
        menu color sel 0 #ffffffff #00000000 none

        #Title bar
        menu color title 0 #ff7ba3d0 #00000000 none

        #Press [Tab] message
        menu color tabmsg 0 #ff3a6496 #00000000 none

        #Unselected menu item
        menu color unsel 0 #84b8ffff #00000000 none

        #Selected hotkey
        menu color hotsel 0 #84b8ffff #00000000 non

        #Unselected hotkey
        menu color hotkey 0 #ffffffff #00000000 none
        #Help text
        menu color help 0 #ffffffff #00000000 none

        #A scrollbar of some type? Not sure.
        menu color scrollbar 0 #ffffffff #ff355594 none

        #Timeout msg
        menu color timeout 0 #ffffffff #00000000 none
        menu color timeout_msg 0 #ffffffff #00000000 none

        #Command prompt text
        menu color cmdmark 0 #84b8ffff #00000000 none
        menu color cmdline 0 #ffffffff #00000000 none

        #Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message.

        menu tabmsg Press Tab for full configuration options on menu items.

        menu separator # insert an empty line
        menu separator # insert an empty line

        label linux
        menu label ^Install CentOS 7
        kernel vmlinuz
        #append initrd=initrd.img inst.stage2=hd:LABEL=CentOS\\x207\\x20x86_64 quiet
        append initrd=initrd.img repo=http://192.168.138.5/cdrom ks=http://192.168.138.5/ks.cfg

        label check
        menu label Test this ^media & install CentOS 7
        menu default
        kernel vmlinuz
        append initrd=initrd.img inst.stage2=hd:LABEL=CentOS\\x207\\x20x86_64 rd.live.check quiet

        menu separator # insert an empty line

        #utilities submenu
        menu begin ^Troubleshooting
        menu title Troubleshooting

        label vesa
        menu indent count 5
        menu label Install CentOS 7 in ^basic graphics mode
        text help
        Try this option out if you\’re having trouble installing
        CentOS 7.
        endtext
        kernel vmlinuz
        append initrd=initrd.img inst.stage2=hd:LABEL=CentOS\\x207\\x20x86_64 xdriver=vesa nomodeset quiet

        default cdrom
        prompt 0

        label rescue
        menu indent count 5
        menu label ^Rescue a CentOS system
        text help
        If the system will not boot, this lets you access files
        and edit config files to try to get it booting again.
        endtext
        kernel vmlinuz
        append initrd=initrd.img inst.stage2=hd:LABEL=CentOS\\x207\\x20x86_64 rescue quiet

        label memtest
        menu label Run a ^memory test
        text help
        If your system is having issues, a problem with your
        system\’s memory may be the cause. Use this utility to
        see if the memory is working correctly.
        endtext
        kernel memtest

        label cdrom
        kernel vmlinuz
        append initrd=initrd.img ks=http://192.168.138.5/ks.cfg devfs=nomount

        menu separator # insert an empty line

        label local
        menu label Boot from ^local drive
        localboot 0xffff

        menu separator # insert an empty line
        menu separator # insert an empty line

        label returntomain
        menu label Return to ^main menu
        menu exit

        menu end

        重启httpd服务

        cp /var/www/html/cdrom/isolinux/vesamenu.c32 /var/lib/tftpboot/

        4、安装dhcp服务

        yum –y install dhcp

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

        修改dhcpd.conf

        使用vmware测试PXE批量安装服务器的详细过程

        next-server 192.168.138.5; ——————本机地址,作为ks服务器的地址
        filename “pxelinux.0”;

        subnet 192.168.138.0 netmask 255.255.255.0 {

        range 192.168.138.10 192.168.138.50; ———–分配的地址池
        option routers 192.168.138.5;
        option subnet-mask 255.255.255.0;
        option domain-name-servers 192.168.138.5;
        default-lease-time 86400;
        max-lease-time 86400;
        }

        配置好后启动dhcp

        service dhcpd start

        三、安装kickstart自动安装工具

        Yum直接安装

        yum -y install system-config-kickstart

        在桌面环境下启动Kickstart

        system-config-kickstart

        使用vmware测试PXE批量安装服务器的详细过程
        使用vmware测试PXE批量安装服务器的详细过程
        使用vmware测试PXE批量安装服务器的详细过程

        分区自己看情况分配,usr目录尽量分配4G以上

        使用vmware测试PXE批量安装服务器的详细过程
        使用vmware测试PXE批量安装服务器的详细过程
        使用vmware测试PXE批量安装服务器的详细过程
        使用vmware测试PXE批量安装服务器的详细过程
        使用vmware测试PXE批量安装服务器的详细过程

        安装包选择桌面版可安装图形版,自行选择。如果该步骤报错,看yum配置

        使用vmware测试PXE批量安装服务器的详细过程
        使用vmware测试PXE批量安装服务器的详细过程

        下面两项默认即可
        配置好后file–>save

        使用vmware测试PXE批量安装服务器的详细过程

        保存到该目录下,查看ks.cfg文件

        #platform=x86, AMD64, or Intel EM64T
        #version=DEVEL
        #Install OS instead of upgrade
        install
        #Keyboard layouts
        keyboard ‘us\’
        #Root password
        rootpw –iscrypted 11PObWbosO$B09PFFThWxWujr.TANYuJ.
        #Use network installation
        url –url=“ http://192.168.138.5/cdrom”
        #System language
        lang en_US
        #System authorization information
        auth –useshadow –passalgo=sha512
        #Use graphical install
        graphical
        firstboot –disable
        #SELinux configuration
        selinux –disabled

        #Firewall configuration
        firewall –disabled
        #Network information
        network –bootproto=dhcp –device=ens33
        #Reboot after installation
        reboot
        #System timezone
        timezone Asia/Shanghai
        #System bootloader configuration
        bootloader –location=mbr
        #Clear the Master Boot Record
        zerombr
        #Partition clearing information
        clearpart –all –initlabel
        #Disk partitioning information
        part / –fstype=“xfs” –size=10240
        part /boot –fstype=“xfs” –size=2048
        part /home –fstype=“xfs” –size=1024
        part /var –fstype=“xfs” –size=2048
        part /tmp –fstype=“xfs” –size=2048
        part /usr –fstype=“xfs” –size=4096
        part /opt –fstype=“xfs” –size=4096
        part swap –fstype=“swap” –size=4096

        %packages
        @desktop-debugging
        @fonts
        @gnome-desktop
        @kde-desktop
        @legacy-x
        @x11
        xterm

        %end

        四、在客户主机上测试

        新建一个虚拟机,进pxe选择从网络加载dhcp,然后就直接自动安装即可

        在 /var/lib/dhcpd/dhcpd.leases里可以看见新增机器分配的ip地址等信息

        使用vmware测试PXE批量安装服务器的详细过程

        五、相关服务

        systemctl start httpd
        systemctl enable httpd
        systemctl start dhcpd
        systemctl enable dhcpd
        systemctl start xinetd

        自己亲测可行,有问题欢迎咨询探讨!

        到此这篇关于使用vmware测试PXE批量安装服务器的详细过程的文章就介绍到这了,更多相关vmware测试PXE内容请搜索趣讯吧以前的文章或继续浏览下面的相关文章希望大家以后多多支持趣讯吧!

        版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,请发送邮件至 55@qq.com 举报,一经查实,本站将立刻删除。转转请注明出处:https://www.szhjjp.com/n/11871.html

        (0)
        nan
        上一篇 2021-08-11
        下一篇 2021-08-11

        相关推荐

        • 故剑情深诏书原文(故剑情深的典故)

          在我国古代皇帝大都妻妾如云,坐拥三宫六院。今天我们就来体会一位皇帝对糟糠之妻的浓浓情感。大家不少人都看过电视剧《乌龙闯情关》,里面的刘病已就是今天我们的主角,也就是汉宣帝刘询,他的爷爷就是蛊惑之乱中被杀的戾太子刘据,而刘询此时尚不满周岁,

          2021-11-28
          0
        • 保单抵押贷款办理条件(保单抵押贷款怎么办理)

          现在我们的保险意识普遍比较强,知道配置保险的重要性,不同保险产品的作用不同,有的可以减轻医疗负担,有的可以弥补收入损失,有的产品还可以实现理财需求。有些保单还能贷款,那么保单贷款需要什么条件?能贷多少钱呢?如果你也想知道的话就一起来看看吧。

          2021-12-16
          0
        • 淘宝优惠券去哪里找?淘宝优惠券是怎么赚钱的?

          虽然淘宝、天猫优惠券(以下简称淘宝优惠券)出来已久,但还是有很多人不知道,甚至我们搜索百度,都没有人把这个事情讲清楚的,也没有百度百科。那么今天,我就抖胆在这里说上几句,希望能够抛砖引玉。一、什么是淘宝优惠券?淘宝优惠券,也称淘宝隐藏优惠券,是淘

          2021-10-18
          0
        • 真的是淘宝亲手杀死了淘品牌吗?

          真的是淘宝亲手杀死了淘品牌吗?,久久派带你了解相关信息。淘宝亲手杀死了淘品牌?成也淘宝,败也淘宝?这些论调有一些大的媒体居然都发出这样的观点?就好像有人挖了一口井,你喝了水,最后被撑饱了,开始骂这口井!你说这个道理真的是对的吗?他们是这样认为的,淘品牌的流量时代结束,一方面在于平台的流量逐渐向国际品牌、新品牌倾斜,与此同时,阿里电商体系内的流量红利也在渐渐消失,获客成

          2021-11-04
          0
        • 从混乱到凝聚力:建立可重复的产品流程

          编辑导语:在公司中一个团队是非常重要的,团队的力量可以在业务流程中发挥出更加重要的作用,在产品的不同阶段也需要不同的流程以及配合,所以建立可重复的产品流程是非常有效的;本文作者分享了关于建立不同阶段的工作流程的例子,我们一起来了解一下。建立可重复的流程:除了仔细考虑团队的结构和指导团队决策的原则之外,规范化的流程也有助于促进凝聚力。正如我们在本章开头所提…

          2021-08-16
          0
        • 职场大神必备5款Windows 10办公神器分享(五大常用办公软件有哪些)

          工作久了,每个人会有私藏的几款,电脑上装机必备神器,能让工作效率提高几倍都不止。 这里就来分享5款,我一直在用的Windows 10必备神器,强大又实用,希望对你也有所帮助。 1、…

          2021-10-23 用户投稿
          0

        发表回复

        登录后才能评论