PXE自动装机

                                                                                                        ——————白·月

[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33

TYPE=Ethernet

BOOTPROTO=static

DEFROUTE=yes

PEERDNS=yes

PEERROUTES=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_PEERDNS=yes

IPV6_PEERROUTES=yes

IPV6_FAILURE_FATAL=no

IPV6_ADDR_GEN_MODE=stable-privacy

NAME=ens33

UUID=143ead7d-ba46-42a2-a06b-c0c472b94c66

DEVICE=ens33

ONBOOT=yes

IPADDR=192.168.1.1

NETMASK=255.255.255.0

[root@localhost ~]# systemctl restart network

[root@localhost ~]# ifconfig

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.1.1  netmask 255.255.255.0  broadcast 192.168.1.255

        inet6 fe80::8cc1:fbec:51d6:82c6  prefixlen 64  scopeid 0x20<link>

        ether 00:0c:29:45:b2:6f  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 6  bytes 468 (468.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 1  (Local Loopback)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

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

[root@localhost yum.repos.d]# rm -rf *

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

[a]

name=a

baseurl=file:///media

gpgcheck=0

[root@localhost yum.repos.d]# mount /dev/cdrom /media

mount: /dev/sr0 is write-protected, mounting read-only

[root@localhost yum.repos.d]# yum -y install vsftpd

Installed:

  vsftpd.x86_64 0:3.0.2-21.el7                                           

Complete!

[root@localhost yum.repos.d]# mkdir /var/ftp/centos7

[root@localhost yum.repos.d]# cp -rf /media/*  /var/ftp/centos7/

[root@localhost yum.repos.d]# systemctl start vsftpd

[root@localhost yum.repos.d]# yum -y install tftp-server

Installed:

  tftp-server.x86_64 0:5.2-13.el7                                        

Complete!

[root@localhost yum.repos.d]# vim /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

        per_source              = 11

        cps                     = 100 2

        flags                   = IPv4

}

[root@localhost yum.repos.d]# systemctl start tftp

[root@localhost yum.repos.d]# cd

[root@localhost ~]# cd /media/images/pxeboot/

[root@localhost pxeboot]# cp vmlinuz initrd.img /var/lib/t

tftpboot/ tpm/   

[root@localhost pxeboot]# cp vmlinuz initrd.img /var/lib/tftpboot/

[root@localhost pxeboot]# cd

[root@localhost ~]# yum -y install syslinux

Installed:

  syslinux.x86_64 0:4.05-13.el7                                          

Dependency Installed:

  mtools.x86_64 0:4.0.18-5.el7                                           

Complete!

[root@localhost ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

[root@localhost ~]# mkdir /var/lib/tftpboot/pxelinux.cfg

[root@localhost ~]# cd /var/lib/tftpboot/pxelinux.cfg/

[root@localhost pxelinux.cfg]# vim default

default auto

prompt 1

label auto

        kernel vmlinuz

        append initrd=initrd.img method=ftp://192.168.1.1/centos7

label linux text

        kernel vmlinuz

        append text initrd=initrd.img method=ftp://192.168.1.1/centos7

label linux rescue  

        kernel vmlinuz

        append rescue initrd=initrd.img method=ftp://192.168.1.1/centos7

[root@localhost pxelinux.cfg]# cd

[root@localhost ~]# yum -y install dhcp

Installed:

  dhcp.x86_64 12:4.2.5-47.el7.centos                                     

Complete!

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

cp: overwrite ‘/etc/dhcp/dhcpd.conf’? y

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

# A slightly different configuration for an internal subnet.

subnet 192.168.1.0 netmask 255.255.255.0 {

  range 192.168.1.1  192.168.1.100;

  option domain-name-servers 192.168.1.1;

  option domain-name "internal.example.org";

  option routers 192.168.1.1;

  option broadcast-address 192.168.1.255;

  default-lease-time 600;

  max-lease-time 7200;

  next-server 192.168.1.1;

  filename "pxelinux.0";

}

[root@localhost ~]# systemctl start dhcpd

[root@localhost ~]# yum -y install system-config-kickstart.noarch

Installed:

  system-config-kickstart.noarch 0:2.9.6-1.el7                           

Dependency Installed:

  system-config-keyboard.noarch 0:1.4.0-4.el7                            

  system-config-keyboard-base.noarch 0:1.4.0-4.el7                       

  system-config-language.noarch 0:1.4.0-7.el7                            

  usermode-gtk.x86_64 0:1.111-5.el7

 

 

 

[root@localhost ~]# vim ks.cfg

%packages

@^kde-desktop-environment

@backup-client

@base

@compat-libraries

@core

@desktop-debugging

@development

@dial-up

@directory-client

@fonts

@guest-agents

@guest-desktop-agents

@input-methods

@internet-applications

@internet-browser

@java-platform

@kde-apps

@kde-desktop

@kde-media

@legacy-x

@multimedia

@network-file-system-client

@networkmanager-submodules

@office-suite

@print-client

@security-tools

@smart-card

@x11

kexec-tools

%end

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

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

[development]

name=a

baseurl=ftp://192.168.1.1/centos7

gpgcheck=0

[root@localhost yum.repos.d]# systemctl restart vsftpd

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值