CentOS6 PEX自动化安装

PXE无人值守安装
需要的软件包: httpd tftp tftp-server dhcp
1.将安装光盘复制到/var/www/html,确保可通过网络访问.

2.service xinetd start 启动守护进程
chkconfig xinetd on

3.vim /etc/xinetd.d/tftp
tftp配置文件记录了共享目录位置
server-args = -s /var/lib/tftpboot
启用tftp
disable = no

4. 将安装光盘中的isolinux目录中的所有文件复制到tftpboot.
5. yum install syslinux
find / -name "pxelinux.0"
一般的位置是: /usr/share/syslinux/pxelinux.0
6. pxelinux.0复制到 tftpboot 目录.
7. tftpboot 目录下创建 pxelinux.cfg 目录
8. cp isolinux.cfg pxelinux.0/default
复制isolinux.cfg文件到pxelinux.0下并改名为default
打开default文件. append 行后添加 ks=[服务器上kickstart文件路径]
注意:每一个label代表启动菜单的一项,添加kickstart路径到正确的位置.
[示例]
label linux
menu label ^Install or upgrade an existing system
menu default
kernel vmlinuz
append initrd=initrd.img ks=http://172.16.253.1/kickstart/ks.cfg
注意:kickstart文件放到在局域网内可访问的地址,如http目录下.并保证有访问权限.
不需要的label项可以删除.

9. 配置dhcp
/etc/dhcp/dhcpd.conf文件修改

全局参数添加:
allow booting;
allow bootp;

subnet子句添加:
next-server PXE服务器地址IP;
filename "pxelinux.0";

-----------------------------dhcp.conf配置文件示例---------------------------

#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
# see 'man 5 dhcpd.conf'
#
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
allow booting;
allow bootp;
option domain-name-servers 172.16.253.1;
subnet 172.16.253.0 netmask 255.255.255.0 {
range 172.16.253.100 172.16.253.200;
option subnet-mask 255.255.255.0;
option routers 172.16.253.1;
next-server 172.16.253.1;
filename "pxelinux.0";
}

-----------------------------dhcp.conf配置文件示例---------------------------

10. 制作kickstart文件
安装system-config-kickstart软件包生成kickstart文件.
生成的文件放到/var/www/html目录下并添加可读权限.

-----------------------------kickstart配置文件示例---------------------------

#platform=x86, AMD64, 或 Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url="http://172.16.253.1/centos6.4"
# Root password
rootpw --iscrypted $1$Aa.Xj8WN$Kew.OWekscWqgdeiUMUvI1
# 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 --disabled
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone Asia/Shanghai
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel 
# Disk partitioning information
part /boot --asprimary --fstype="ext4" --size=200
part / --fstype="ext4" --size=200000
part /var --fstype="ext4" --grow --size=1

%packages
@additional-devel
@base
@basic-desktop
@chinese-support
@compat-libraries
@console-internet
@debugging
@desktop-debugging
@desktop-platform
@desktop-platform-devel
@development
@directory-client
@fonts
@general-desktop
@graphical-admin-tools
@hardware-monitoring
@input-methods
@internet-browser
@large-systems
@legacy-unix
@legacy-x
@mainframe-access
@mysql
@mysql-client
@network-file-system-client
@network-tools
@performance
@remote-desktop-clients
@server-platform
@server-platform-devel
@storage-client-multipath
@system-admin-tools
@web-server
@x11
crypto-utils

%end

-----------------------------kickstart配置文件示例---------------------------

原文地址:https://www.cnblogs.com/viator42/p/3341265.html