网络服务器
IP: 192.168.20.129
yum -y install httpd tftp-server syslinux dhcp xinetd
mkdir -p /media/CentOS
mount /dev/cdrom /media/CentOS
/bin/cp -afr /media/CentOS/* /var/www/html
mkdir -p /tftpboot/pxelinux.cfg/
cp /media/CentOS/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
sed -i '/disable/s/yes/no/' /etc/xinetd.d/tftp
cp /usr/share/syslinux/pxelinux.0 /tftpboot/
cp /media/CentOS/isolinux/{vmlinuz,initrd.img} /tftpboot/
export ip=$(ifconfig eth0 |awk -F '[: ]' '/inet addr/{print $13}')
cat > /var/www/html/ks.cfg << EOF
install
url --url {ip}
text
lang zh_CN.UTF-8
keyboard us
skipx
network --device eth0 --bootproto dhcp
rootpw --iscrypted \$1\$OdwHLBDG\$L40HOSz//Z7wLH5NzwJkv/
firewall --enabled --port=22:tcp
authconfig --enableshadow --enablemd5
selinux --disabled
timezone --utc Asia/Shanghai
bootloader --location=mbr --driveorder=sda
clearpart --all --drives=sda
part /boot --fstype ext3 --size=100 --ondisk=sda
part / --fstype ext3 --size=30000 --ondisk=sda
part swap --size=8192 --ondisk=sda
%packages
@chinese-support
@core
@development-tools
@editors
imake
reboot --eject
EOF
cat > /tftpboot/pxelinux.cfg/default << EOF
default linux
prompt 1
timeout 1
label linux
kernel vmlinuz
append ks ksdevice=eth0 ks={ip}/ks.cfg initrd=initrd.img text
EOF
export net=$(echo $ip |awk 'BEGIN{FS=OFS="."}NF-- {print $0}')
export netmask=$(ifconfig eth0 |awk -F '[ :]' '/Mask/ {print $NF}')
cat > /etc/dhcpd.conf << EOF
ddns-update-style interim;
ignore client-updates;
subnet ${net}.0 netmask $netmask {
# --- default gateway
option routers ${net}.1;
option subnet-mask ${netmask};
option nis-domain "domain.org";
option domain-name "domain.org";
option domain-name-servers ${net}.1;
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp ${net}.200 ${net}.254;
default-lease-time 21600;
max-lease-time 43200;
filename "pxelinux.0";
next-server ${ip};
}
EOF
unset ip
unset netmask
unset net
service xinetd restart
service dhcpd restart
service httpd restart
阅读(1913) | 评论(0) | 转发(0) |