zoukankan      html  css  js  c++  java
  • 利用PXE引导安装centos7

    # 利用PXE引导安装centos7 #

    ###简介###
    > PXE (Pre-boot Execution Environment,PXE client 在网卡的 ROM 中,当计算机引导时,BIOS 把 PXE client 调入内存执行,由 PXE client 将放置在远端的文件通过网络下载到本地运行。运行 PXE 协议需要设置 DHCP 服务器和 TFTP 服务器。

    > DHCP设定分配的IP地址和需要请求的filename,PXE客户端启动,从DHCP服务器获取IP和要下载的文件名"pxelinux.0",然后从TFTP服务器请求加载"pxelinux.0"和默认的配置文件"pxelinux.cfg/default"。

    > 客户端再根据"pxelinux.cfg/default"里面的引导配置从TFTP服务器下载对应linux内核"vmlinuz"和ramdisk的映像文件"initrd.img"(initialized ram disk-【ramdisk是用一部分内存模拟成磁盘】)。并且指定linux-repo镜像的路径和kickstart文件路径。

    > 客户端再加载centos7-repo镜像,根据kickstart配置ks.cfg文件的预定义设置安装linux,实现全自动无人值守。

    ### 安装设置流程 ###



    1、下载tinyPXEserver, http://erwan.labalec.fr/tinypxeserver/pxesrv.zip

    > tinyPXEserver的TFTP默认路径根位置为 C:pxesrvfile

    2、复制centos7镜像中isolinux/*所有文件到 C:pxesrvfilecentos7ks

    3、解压centos7整个镜像到 C:pxesrvfilescentos7image

    4、生产kickstart配置文件

    ```
    [root@localhost ~]# yum -y install system-config-kickstart
    [root@localhost ~]# system-config-kickstart   **图形界面设定**
    [root@localhost ~]# ksvalidator ks.cfg   **检查语法错误**

    ```
    ks.cfg配置范例
    ```
    #platform=x86, AMD64, or Intel EM64T
    #version=DEVEL
    # Install OS instead of upgrade
    install
    # Keyboard layouts
    keyboard 'us'
    # Root password
    rootpw --iscrypted $6$lZCgRcTkckxJO5f7$Haf4hJ5luwvP18X6FRgR/oiGQw5/xdtUELPYVG4UWKtKBhr6/Xhq9Xz07CcAIUJ59d7gQRgtlyEtBMe/Y58Wm0
    # Use network installation
    url --url="http://10.10.33.33/centos7image"
    # System language
    lang en_US
    # Firewall configuration
    firewall --disabled
    # System authorization information
    auth  --useshadow  --passalgo=sha512
    # Use graphical install
    graphical
    # SELinux configuration
    selinux --disabled
    # Do not configure the X Window System
    skipx

    # Network information
    network  --bootproto=static --device=eno16777736 --gateway=10.10.3.1 --ip=10.10.3.88 --nameserver=114.114.114.114 --netmask=255.255.255.0
    # Reboot after installation
    reboot
    # System timezone
    timezone Asia/Shanghai
    # adduser huangjunfa
    user --groups=wheel --name=huangjunfa --password=$6$32.WTXgxXYZsaicF$iQmGWjI1bhXgPcAMCT/5vIgUSHQ7KVt2YAgJa2zXVSimgmKfRndClq4ftLkweE6WZ83lZvdNUrlljiuwe2oaG/ --iscrypted --gecos="huangjunfa"
    # System bootloader configuration
    bootloader --location=mbr
    # Clear the Master Boot Record
    zerombr
    # Partition clearing information
    clearpart --all --initlabel
    # Disk partitioning information
    part /boot --fstype="xfs" --size=300
    part swap --fstype="swap" --recommended
    part / --fstype="xfs" --grow --size=1

    %packages
    @^minimal
    @core
    kexec-tools

    %end

    %addon com_redhat_kdump --enable --reserve-mb='auto'

    %end
    ```
    4、复制pxelinux.0 menu.c32 memdisk mboot.c32 chain.c32 文件到 C:pxesrvfiles

    来源于
    ```
    [root@localhost etc]# yum -y install syslinux
    SFTP>get /usr/share/syslinux/pxelinux.0

    ```

    5、编辑 C:pxesrvfilespxelinux.cfgdefault    # default文件,必须为这个名称

    加入下面代码
    ``` 
    label linux
      menu label ^Install CentOS7ks
      kernel centos7ks/vmlinuz
      append initrd=centos7ks/initrd.img repo=http://10.10.33.33/centos7image ks=http://10.10.33.33/centos7ks/ks.cfg

    ```

    ### end ###

  • 相关阅读:
    第四周
    第二次作业
    jsp
    软件测试第一次
    增删改查
    用户添加
    登录
    购物商城
    jsp第七周作业
    jsp第六周作业
  • 原文地址:https://www.cnblogs.com/fatt/p/6922983.html
Copyright © 2011-2022 走看看