歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> PXE全自動安裝linux

PXE全自動安裝linux

日期:2017/2/27 16:06:33   编辑:Linux教程
1. 安裝環境
yum -y install tftp tftp-server dhcp syslinux
chkconfig xinetd off
chkconfig --level 3 xinetd on
chkconfig tftp off
chkconfig --level 3 tftp on
chkconfig dhcpd off
chkconfig --level 3 dhcpd on
chkconfig portmap off
chkconfig --level 3 portmap on
chkconfig nfs off
chkconfig --level 3 nfs on
2. 配置
vi /etc/xinetd.d/tftp
vi /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;

subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
filename "pxelinux.0";
next-server 192.18.1.110;
option domain-name-servers 192.168.1.1;
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 192.168.1.200 192.168.1.210;
default-lease-time 21600;
max-lease-time 43200;

# we want the nameserver to appear at a fixed address
host ns {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 207.175.42.254;
}
}
service xinetd restart
service tftp restart

#組建PXE環境
mkdir -p /tftpboot/pxelinux.cfg
cp /usr/lib/syslinux/pxelinux.0 /tftpboot
cp /usr/lib/syslinux/menu.c32 /tftpboot
cp /CentOS5.5/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
cp /CentOS5.5/images/pxeboot/initrd.img /tftpboot
cp /CentOS5.5/images/pxeboot/vmlinuz /tftpboot
chmod u+w /tftpboot/pxelinux.cfg/default
vi /tftpboot/pxelinux.cfg/default
default menu.c32
timeout 15

label auto
menu label Auto Install CentOS5.5_32bit
menu default
kernel vmlinuz
append ks=nfs:192.168.1.110:/CentOS5.5/ks.cfg initrd=initrd.img
label custom
menu label Custom Install CentOS5.5_32bit
kernel vmlinuz
append initrd=initrd.img
label rescue
menu label Rescue
kernel vmlinuz
append ks initrd=initrd.img rescue


#配置nfs
vi /etc/exports
/CentOS5.5 *(ro)
service portmap start
service nfs start
exportfs

#kickstart
yum -y install system-config-kickstart(須安裝桌面環境)
vi ks.cfg
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Use graphical install
#graphical
text
# Firewall configuration
firewall --disabled
key --skip
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Installation logging level
logging --level=info
# Use network installation
#url --url=http://192.168.1.110/centos/
nfs --server=192.168.1.110 --dir=/CentOS5.5
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# Reboot after installation
reboot
#Root password
rootpw --iscrypted $1$3LO7K8pW$mvZZ/qaBakJNgz.v3RjRs1

# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# System timezone
timezone Asia/Shanghai
# Install OS instead of upgrade
install
# Disk partitioning information
part / --bytes-per-inode=4096 --fstype="ext3" --size=30720
part swap --bytes-per-inode=4096 --fstype="swap" --size=1024

%packages
@base
@development-libs
@development-tools
@admin-tools
@system-tools
Copyright © Linux教程網 All Rights Reserved