基于centos7的PXE自动化安装centos6,7
环境:
两台主机
一台DHCP,HTTPD,TFTP服务器(一个网卡172.16.44.7,仅主机),一台测试机(一个网卡,仅主机)
关闭仅主机的vmware中dhcp服务
#创建ks文件
yum install system-config-kickstart #kickstart图形化工具
#使用图形化工具创建ks应答文件
#centos7需要修改yum仓库,添加一个"development"的yum仓库
[root@Centos7 ~]# cat ks6_mini.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://172.16.44.7/centos/6/os/x86_64"
# Root password default:centos
rootpw --iscrypted $1$JmO.k3YO$aE.aDZUW/6QQTeIXi0Phn0
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
#graphical
text
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone 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
# Disk partitioning information
part /boot --fstype="ext4" --size=200
part / --fstype="ext4" --size=102400
part /data --fstype="ext4" --size=51200
part swap --fstype="swap" --size=4096
%packages
@core
%end
[root@Centos7 ~]# cat /var/www/html/ksdir/ks6_desktop.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://172.16.44.7/centos/6/os/x86_64"
# Root password default:centos
rootpw --iscrypted $1$iDhaegPv$emFtFFmLkKBNXq6GgGZ/j.
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
text
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone Asia/Shanghai
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# System bootloader configuration
bootloader --append="crashkernel=auto rhgb quiet" --location=mbr --driveorder="sda"
# Partition clearing information
clearpart --all
# Disk partitioning information
part /boot --fstype="ext4" --size=200
part / --fstype="ext4" --size=102400
part /data --fstype="ext4" --size=51200
part swap --fstype="swap" --size=4096
%packages
@base
@basic-desktop
@core
@debugging
@desktop-debugging
@desktop-platform
@directory-client
@fonts
@general-desktop
@graphical-admin-tools
@input-methods
@internet-applications
@internet-browser
@java-platform
@kde-desktop
@legacy-x
@network-file-system-client
@office-suite
@print-client
@remote-desktop-clients
@server-platform
@server-policy
@workstation-policy
@x11
abrt-gui
certmonger
device-mapper-persistent-data
genisoimage
krb5-workstation
libXmu
mtools
oddjob
pam_krb5
pax
python-dmidecode
qt-mysql
rdesktop
samba-winbind
sgpio
wodim
xorg-x11-xdm
xsettings-kde
xterm
%end
[root@Centos7 ~]# cat ks7_mini.cfg
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig --startxonboot
# Keyboard layouts
# old format: keyboard us
# new format:
keyboard