码迷,mamicode.com
首页 > 系统相关 > 详细

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

时间:2016-02-05 01:09:49      阅读:299      评论:0      收藏:0      [点我收藏+]

标签:

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)

标签:

原文地址:http://www.cnblogs.com/edward2013/p/5182202.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!