CentOS 6.5 PXE一鍵安裝Linux操作系統

#安裝配置DHCP
yum -y install dhcp
cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
vim /etc/dhcp/dhcpd.conf        
subnet 192.168.3.0 netmask 255.255.255.0 {
  range 192.168.3.100 192.168.3.200;
  option domain-name-servers server.example.com;
  option domain-name "8.8.8.8";
  option routers 192.168.3.1;
  option broadcast-address 192.168.3.255;
  next-server 192.168.3.100;
  filename "pxelinux.0";
  default-lease-time 60000;
  max-lease-time 720000;
}
service dhcpd start
chkconfig dhcpd on

#配置xinetd服務器
yum -y install syslinux tftp-server
vim /etc/xinetd.d/tftp
disable=no
service xinetd start
chkconfig xinetd on

#拷貝引導文件
cd /var/lib/tftpboot   
cp /mnt/isolinux/* .
cp /usr/share/syslinux/pxelinux.0 .
mkdir pxelinux.cfg
cd pxelinux.cfg
cp /mnt/isolinux/isolinux.cfg ./default  
vim default    
label Install RHEL6.5 
  kernel vmlinuz
  append initrd=initrd.img ks=nfs:192.168.3.100:/var/lib/tftpboot/ks.cfg 
  
#配置NFS服務
yum -y install nfs*    
mkdir /rhel6
mount /dev/cdrom /rhel6
vim /etc/exports    
/rhel6    192.168.3.0/24(rw,sync)
service nfs start
chkconfig nfs on

yum -y install system-config-kickstgart
system-config-kickstart		#創建一鍵安裝腳本

#手動寫入腳本
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use NFS installation media
nfs --server=192.168.3.100 --dir=/mnt
# Root password
rootpw --iscrypted $1$3X.jwnPp$90YJQkQsBqTdL4aPRsgKc/
# 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 --isUtc Asia/Shanghai
# Network information
network  --bootproto=dhcp --device=eth0 --onboot=on
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype="ext4" --size=200
part / --fstype="ext4" --grow --size=1

%packages
@basic-desktop
@desktop-debugging
@desktop-platform
@fonts
@general-desktop
@graphical-admin-tools
@input-methods
@kde-desktop
@legacy-x
@remote-desktop-clients
@x11

%end


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章