centos6 网络安装

# pxelinux.cfg
default menu.c32
prompt 0
timeout 100 
 
LABEL centos-6
    MENU DEFAULT
    MENU LABEL 78:2b:cb:69:10:f3
    KERNEL centos-6/vmlinuz
    APPEND initrd=centos-6/initrd.img ks=http://install.localhost/kickstart/78:2b:cb:69:10:f3 ksdevice=link ramdisk_size=102400 console=tty0 console=ttyS1,115200
# kickstart
lang en_US.UTF-8
keyboard us
timezone Asia/Shanghai

auth --enableshadow --passalgo=sha512
#python -c 'import crypt; print(crypt.crypt("MyPassword", "$6$MySalt"))'
rootpw --iscrypted $6$MySalt$QjVAS1jJvAZy4xriAh5iZhtkl37HlGkLHiyFsN/dba7GJGd4Kc8iw4I3ztca/uZ9jzyqwN753vqORY5XlgN6G/
text
install
skipx
url --url http://install.localhost/centos-6

bootloader --location=mbr 
zerombr
clearpart --drives=sda --all #--initlabel 

part swap --fstype='swap' --ondisk=sda --size=8000
part / --fstype='ext4' --ondisk=sda --size=50000
part /opt --fstype='ext4' --ondisk=sda --grow --size=1

network --device=78:2b:cb:69:10:f3 --bootproto=dhcp --activate

firewall --disabled
selinux --disabled
services --disabled=NetworkManager,ip6tables,iptables,postfix,cpuspeed
services --enabled=network
firstboot --disabled
reboot

%packages
@Base
wget
%end

%pre
clearpart --drives=sda --all
/usr/sbin/parted -s /dev/sda mklabel gpt
%end

%post
cat > /etc/sysconfig/network-scripts/ifcfg-em1 << _EOF_
DEVICE=em1
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.48.122
NETMASK=255.255.255.0
_EOF_

cat > /etc/sysconfig/network << _EOF_
NETWORKING=yes
HOSTNAME=bjyh-48-122
GATEWAY=192.168.48.1
_EOF_

/usr/bin/rm -rf /etc/yum.repos.d/*
/usr/bin/curl http://yum.localhost/centos.repo -o /etc/yum.repos.d/centos.repo
/usr/bin/curl http://yum.localhost/epel.repo -o /etc/yum.repos.d/epel.repo
%end

你可能感兴趣的:(centos6 网络安装)