RedHat7搭建无人值守自动安装Linux操作系统(PXE+Kickstart)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RedHat7搭建无人值守自动安装Linux操作系统(PXE+Kickstart)相关的知识,希望对你有一定的参考价值。

Kickstart服务器

IP: 192.168.136.253   掩码:255.255.255.0   网关:192.168.136.2   DNS:192.168.136.2

  • 安装部署yum源服务器

参考 http://www.cnblogs.com/edward2013/p/5020113.html

  • 安装部署DHCP服务器
# yum -y install dhcp

修改配置文件

# vi /etc/dhcp/dhcpd.conf

#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.example
#   see dhcpd.conf(5) man page
#
log-facility local7;

subnet 192.168.136.0 netmask 255.255.255.0 {
  range 192.168.136.100 192.168.136.200;            #IP地址池范围
  option domain-name "example.com";
  option domain-name-servers 192.168.136.2;
  option routers 192.168.136.2;                     #路由器IP,可以写网关IP
  default-lease-time 600;
  max-lease-time 7200;
  next-server 192.168.136.253;                      #TFTP Server 的IP地址
  filename "pxelinux.0";                            #pxelinux 启动文件位置
}

启动DHCP服务并设置为开机启动

# systemctl start dhcpd
# systemctl enable dhcpd
  • 安装部署TFTP服务器
# yum -y install tftp-server

修改配置文件

# vi /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                       #把这行改成no即可
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

启动TFTP服务并设置为开机自启动

# systemctl start tftp
# systemctl enable tftp

将客户端所需启动文件复制到TFTP服务器

# yum -y install syslinux
# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

复制启动镜像文件和启动配置文件至TFTP共享目录

# cp /content/rhel7/x86_64/dvd/isolinux/{vmlinuz,initrd.img} /var/lib/tftpboot/
# mkdir /var/lib/tftpboot/pxelinux.cfg
# cp /content/rhel7/x86_64/dvd/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
# chmod 644 /var/lib/tftpboot/pxelinux.cfg/default

修改启动配置文件

# vi /var/lib/tftpboot/pxelinux.cfg/default

default linux

...

label linux
  menu label ^Install Red Hat Enterprise Linux 7.2
  kernel vmlinuz  append initrd=initrd.img ks=http://192.168.136.253/rhel7/x86_64/ks.cfg

...
  • 创建Kickstart自动应答文件

 

以上是关于RedHat7搭建无人值守自动安装Linux操作系统(PXE+Kickstart)的主要内容,如果未能解决你的问题,请参考以下文章

yum仓库搭建与PXE全自动无人值守网络装机案例

无人值守,自动化安装linux操作系统

PXE——无人值守自动安装Linux操作系统(踩坑记录)

linux__kickstart无人值守批量安装系统

运用kickstart进行无人值守安装操作系统

[亲测可用] PXE无人值守自动装机