pxe-kickstart批量部署文档

#PXE安装:
    yum install syslinux xinetd tftp-server httpd -y
    yum install dhcp -y
    yum install system-config-kickstart -y
    
------------------------------------------------------
# vi /etc/xinetd.d/tftp

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 
}
----------------------------------------------------------
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
mkdir /var/www/html/cdrom
mount /dev/cdrom /mnt
cp -r /mnt/* /var/www/html/cdrom/
cp /var/www/html/cdrom/images/pxeboot/{initrd.img,vmlinuz} /var/lib/tftpboot/
cp /var/www/html/cdrom/isolinux/*.msg /var/lib/tftpboot/
mkdir /var/lib/tftpboot/pxelinux.cfg
cp /var/www/html/cdrom/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
---------------------------------------------
vi /var/lib/tftpboot/pxelinux.cfg/default

  default linux
prompt 0
timeout 10
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
  kernel vmlinuz
  append initrd=initrd.img ks=http://192.168.222.132/ks.cfg
label text
  kernel vmlinuz
  append initrd=initrd.img text
label ks
  kernel vmlinuz
  append ks initrd=initrd.img
label local
  localboot 1
label memtest86
  kernel memtest
  append -
------------------------------------------------------
vi /etc/dhcp/dhcpd.conf 
ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;
subnet 192.168.222.0 netmask 255.255.255.0 {
    option routers 192.168.222.2;
    option subnet-mask 255.255.255.0;
    option domain-name-servers 114.114.114.114;
    option time-offset -18000;
    range dynamic-bootp 192.168.222.150 192.168.222.254;
    default-lease-time 21600;
    max-lease-time 43200;
    next-server 192.168.222.132;
    filename "pxelinux.0";
}

--------------------------------------------------------

systemctl stop firewalld
sed -i 's/selinux=enforcing/selinux=disable/g' /etc/selinux/config
setenforce 0
--------------------------------------------------------
    systemctl start httpd
    systemctl start xinetd
    systemctl start dhcpd
    systemctl enable dhcpd
    systemctl enable xinetd
    systemctl enable httpd
    
---------------------------------------------------------
vi /var/www/html/ks.cfg  #把里面原来的文件都删了

#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url="http://192.168.222.132/cdrom"
# Root password
rootpw --iscrypted $1$wPJ0QDmK$futy0I9ws94BXuYYXoS6y1
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --enforcing
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone  Asia/Shanghai
# Network information
network  --bootproto=dhcp --device=eno16777736 --onboot=on   #eno16777736是我虚拟机的网卡,戴尔服务器可以换成em*
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --drives=sda
#clearpart --all --drives=sdb
#clearpart --all --drives=sdc
#clearpart --all --drives=sdd
#clearpart --all --drives=sde
# Disk partitioning information
part /boot --fstype="ext4" --size=200
part pv.01 --size=1 --grow --ondisk=sda
volgroup VolGroup pv.01
logvol swap --name=lv_swap --vgname=VolGroup --size=1024
logvol  /  --vgname=VolGroup  --size=50000  --name=lv_root
#logvol  /home  --vgname=VolGroup  --size=1  --grow  --name=lv_home

#part /mnt/sdb --fstype=ext4  --grow --size=1 --ondisk=sdb
#part /mnt/sdc --fstype=ext4  --grow --size=1 --ondisk=sdc
#part /mnt/sdd --fstype=ext4  --grow --size=1 --ondisk=sdd
#part /mnt/sde --fstype=ext4  --grow --size=1 --ondisk=sde

%packages
@remote-desktop-clients

%end
------------------------------------------------------------

 

posted @ 2016-06-28 12:11  BigZero  阅读(276)  评论(0编辑  收藏  举报