1. 服务器列表:

    角色 ip地址
    dhcp+ftp服务器 192.168.8.81
    客户端 -

  2. 安装配置dhcp:
    a. 安装:yum -y install dhcp
    b. 配置:vim /etc/dhcp/dhcpd.conf

    default-lease-time 21600;
    max-lease-time 43200;
    log-facility local7;
    subnet 192.168.8.0 netmask 255.255.255.0 {
    range 192.168.8.10 192.168.8.100;
    option routers 192.168.8.1;
    next-server 192.168.8.81;
    filename "/pxelinux.0";
    }

  3. 安装配置vsftp:
    a. 安装:yum -y install vsftp
    b. 配置:vim /etc/vsftpd/vsftpd.conf

    anonymous_enable=YES
    local_enable=YES
    write_enable=YES
    local_umask=022
    anon_upload_enable=YES
    anon_mkdir_write_enable=YES
    dirmessage_enable=YES
    xferlog_enable=YES
    connect_from_port_20=YES
    xferlog_std_format=YES
    listen=YES
    pam_service_name=vsftpd
    userlist_enable=YES
    tcp_wrappers=YES

  4. 安装配置tftp、xinetd:
    a. 安装:yum -y install tftp-server xinetd
    b. 配置:vim /etc/xinetd.d/tftp

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

  5. 复制系统文件:
    a. 复制安装程序所必须的 initrd.img 和 vmlinuz:cp /home/lee/isolinux/{initrd.img,vmlinuz} /var/lib/tftpboot/
    b. 安装syslinux:yum -y install syslinux
    c. 复制 pxelinux.0:cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
    d. 创建 pxelinux.cfg 文件夹:mkdir -p /var/lib/tftpboot/pxelinux.cfg/
    e. 复制defaul:cp /home/lee/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
  6. 配置default:vim /var/lib/tftpboot/pxelinux.cfg/default

    default 1
    prompt 1
    timeout 60
    display boot.msg
    menu background splash.jpg
    menu title Welcome to CentOS 7
    menu color border 0 #ffffffff #00000000
    menu color sel 7 #ffffffff #ff000000
    menu color title 0 #ffffffff #00000000
    menu color tabmsg 0 #ffffffff #00000000
    menu color unsel 0 #ffffffff #00000000
    menu color hotsel 0 #ff000000 #ffffffff
    menu color hotkey 7 #ffffffff #ff000000
    menu color scrollbar 0 #ffffffff #00000000
    label 1
    kernel /vmlinuz
    append initrd=initrd.img ramdisk_size=9216 ks=ftp://192.168.8.81/pub/centos/ks.cfg

  7. 拷贝iso 文件
    a. 创建 centos 目录:mkdir -p /var/ftp/pub/centos/
    b. 拷贝系统文件到 centos 目录:cp -ar /home/lee/centos/. /var/ftp/pub/centos/
  8. 配置ks.cfg
    a. 复制ks.cfg:cp /root/anaconda-ks.cfg /var/ftp/pub/centos/ks.cfg
    b. 配置ks.cfg:vim /var/ftp/pub/centos/ks.cfg,加上:

    url --url=ftp://192.168.8.81/pub/centos/

  9. 启动服务:
    a. 启动dhcp:
    systemctl start dhcpd
    b. 启动tftp:
    systemctl start tftp
    systemctl start xinetd
    c. 启动vsftp:
    systemctl start vsftpd
  10. 配置客户端为网络启动:
    无人值守安装CentOS 7
    无人值守安装CentOS 7
  11. 注意事项:
    a. 服务端必须关闭防火墙:
    systemctl stop firewalld
    b. 服务商必须关闭selinux:
    vim /etc/sysconfig/selinux

    SELINUX=disabled
    SELINUXTYPE=targeted