码迷,mamicode.com
首页 > 其他好文 > 详细

PXE自动安装CentOS7

时间:2019-09-07 22:15:58      阅读:89      评论:0      收藏:0      [点我收藏+]

标签:system   rgs   user   doc   centos7   操作   kickstart   ext   dia   

一,搭建无人值守服务器安装软件(PXE + DHCP+TFTP+ Kickstart+ FTP)IP:172.168.1.200

系统版本:CentOS Linux release 7.4.1708 (Core)

关闭selinux,firewalld

[root@localhost ~]# axel -n 100 http://mirror.nsc.liu.se/centos-store/7.4.1708/isos/x86_64/CentOS-7-x86_64-Minimal-1708.iso

[root@localhost ~]# mount CentOS-7-x86_64-Minimal-1708.iso /media/

[root@localhost ~]# yum -y install vsftpd tftp tftp-server xinetd system-config-kickstart syslinux

二,修改配置文件

[root@localhost ~]# vim /etc/xinetd.d/tftp

service tftp
{
    socket_type     = dgram
    protocol        = udp
    wait            = yes
    user            = root
    server          = /usr/sbin/in.tftpd
  server_args       = -s /tftpboot #修改
    disable         = no #修改
    per_source      = 11
    cps         = 100 2
    flags           = IPv4
}

[root@localhost ~]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf

[root@localhost ~]# > /etc/dhcp/dhcpd.conf 

[root@localhost ~]# vim /etc/dhcp/dhcpd.conf

subnet 172.168.1.0 netmask 255.255.255.0 {
range 172.168.1.100 172.168.1.199;
option domain-name-servers 172.168.1.1;
option domain-name "internal.example.org";
option routers 172.168.1.1;
option broadcast-address 172.168.1.255;
default-lease-time 600;
max-lease-time 7200;
next-server 172.168.1.200;
filename "pxelinux.0";
}

三,配置tftp共享文件

[root@localhost ~]# mkdir /tftpboot
[root@localhost ~]# mkdir /tftpboot/pxelinux.cfg
[root@localhost ~]# cp /usr/share/syslinux/pxelinux.0 /tftpboot/
[root@localhost ~]# cp /media/images/pxeboot/initrd.img /tftpboot/
[root@localhost ~]# cp /media/images/pxeboot/vmlinuz /tftpboot/
[root@localhost ~]# cp /media/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default

修改default,指定安装操作系统的方式和ks.cfg文件路径(修改第一行和64行其他不改)

1 default linux    #第一行改成这样

64 append initrd=initrd.img inst.repo=ftp://172.168.1.200/pub inst.ks=ftp://172.168.1.200/ks.cfg  #64行修改成这样

四,配置无人值守软件包

[root@localhost yum.repos.d]# pwd
/etc/yum.repos.d

[root@localhost yum.repos.d]# vim server.repo

[centos7]       

name=my-centos7

baseurl=file:///var/ftp/pub

enabled=1

gpgcheck=0

[root@localhost ~]# cd /var/ftp/pub/

[root@localhost ~]# cp -r /media/* .

[root@localhost ~]# cp anaconda-ks.cfg /var/ftp/ks.cfg

[root@localhost ~]# egrep -v "^#|^$" /var/ftp/ks.cfg

技术图片

[root@localhost ~]# systemctl enable vsftpd xinetd dhcpd
[root@localhost ~]# systemctl restart vsftpd xinetd dhcpd

PXE自动安装CentOS7

标签:system   rgs   user   doc   centos7   操作   kickstart   ext   dia   

原文地址:https://blog.51cto.com/11434894/2436497

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