zoukankan      html  css  js  c++  java
  • Linux下使用Kickstart自动化安装平台架构

    PXE工作于Client/Server的网络模式。在启动过程中,终端要求服务器分配IP地址,再用TFTP协议下载一个自动启动软件包到内存中执行。

    要使用kickstart安装平台,包括完整的架构为:Kickstart+DHCP+NFS+TFTP+PXE,从架构可以看出,大概需要安装的服务,例如dhcp,tftp,nfs,kickstart/pxe等。

    1,安装常用软件

    yum -y install  dhcp* nfs*   tftp*
    

    2,启动tftp服务(跟telnet类似)

    vi /etc/xinetd/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
    }
    
    
    
    #将里边的yes改为no,这个文件中的我已经改掉了
    

    3,TFTP+PXE配置

    要实现远程安装系统,首先需要在TFTP目录下指定PXE内核模块及相关参数。

    配置如下:

    #挂载景象    
     mount /dev/cdrom  /mnt/
    
    #拷贝一个文件到这个目录/var/lib/tftpboot/,如果没有的话需要提前安装find / -name "pxelinux.0"
    yum -y install syslinux 
    find / -name "pxelinux.0"
    cp  /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/


    #创建配置文件目录,并从挂载的景象文件中拷贝一个备份文件
    mkdir -p pxelinux.cfg 
    cp /mnt/isolinux/isolinux.cfg  pxelinux.cfg/default


    #修改default的某些配置
    append ks=nfs:192.168.10.134:/centosinstall/ks.cfg ksdevice=eth0  initrd=initrd.img
    #ks指定启动时的配置文件 ksdevice指定启动时的网卡
    #创建配置目录
    mkdir -pv  /centosinstall
    #创建文件
    touch ks.cfg

      

    4,做NFS共享

    先将/mnt/下面的所有文件拷贝到共享目录

     nohup cp -r /mnt/* . &
    # &的意思是在后台运行
    echo "/centosinstall *(rw,sync)" >> /etc/exports

    在NFS配置文件中加入上述语句/centosinstall *(rw,sync),表示允许任何主机访问/centosinstall目录,有读写权限。

    5,配置kickstart

    可以使用system-kickstart系统软件包来配置,也可以直接拷贝/root/目录下anaconda-ks.cfg 重命名为ks.cfg  ,并把ks.cfg拷贝至刚贡献的/centosinstall 目录下,赋值权限777.

    chmod 777 ks.cfg

    install
    text
    nfs --server=192.168.33.10 --dir=/centosinstall
    key --skip
    lang zh_CN.UTF-8
    keyboard us
    network --device eth0 --bootproto=dhcp --noipv6
    rootpw 123456
    firewall --disabled
    authconfig --enableshadow --enablemd5
    selinux--disabled
    timezone=Asia/shanghai
    bootloader --location=mbr --driveorder=sda --append="rhgb quiet"
    clearpart --all --initlabel
    part /boot --fstype ext3 --size=200
    part swap --size=4000
    part / --fstype ext3 --size=8000
    part /data --fstype ext3 --size=1 --grow
    %packages @^minimal @core kexec-tools %end %addon com_redhat_kdump --enable --reserve-mb='auto' %end %anaconda pwpolicy root --minlen=6 --minquality=50 --notstrict --nochanges --notempty pwpolicy user --minlen=6 --minquality=50 --notstrict --nochanges --notempty pwpolicy luks --minlen=6 --minquality=50 --notstrict --nochanges --notempty %end

      

    这个是centos7的配置文件。

  • 相关阅读:
    Linux--sed使用
    header函数的用法
    php的cli命令行接口
    extract函数在表单提交中提供的方便之处
    sersync实时同步备份的安装
    Centos7 服务器异常处理
    MySQL之——崩溃-修复损坏的innodb:innodb_force_recovery
    记一次oracle内存分配不足,前端访问500报错,如何扩容oracle的memory_target内存
    mysql sql语句整理
    关于控制mysql的binlog日志刷入磁盘频率的参数理解
  • 原文地址:https://www.cnblogs.com/sexiaoshuai/p/7490948.html
Copyright © 2011-2022 走看看