pxe无人值守自动安装
rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum list
yum update
yum -y install tftp-server
rpm -ql tftp-server
/var/lib/tftpboot tftp根目录
chkconfig tftp on
chkconfig xinetd on
chkconfig --list tftp
ss -unlp | grep 69
vi /etc/xinetd.d/tftp
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -u nobody -s /var/lib/tftpboot
per_source = 11
cps = 100 2
flags = IPv4
}
yum install syslinux
mount -o loop CentOS-6.6-x86_64-bin-DVD1.iso /mnt
cp /mnt/isolinux/{vesamenu.c32,vmlinuz,initrd.img} /var/lib/tftpboot/
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot/
mkdir /var/lib/tftpboot/pxelinux.cfg
cp /mnt/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
yum -y install dhcp
vim /etc/dhcp/dhcpd.conf
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.1.108;
option time-offset -18000;
range dynamic-bootp 192.168.1.200 192.168.1.230;
default-lease-time 21600;
max-lease-time 43200;
# Group the PXE bootable hosts together
# # PXE-specific configuration directives...
next-server 192.168.1.108;
filename "pxelinux.0";
authoritative;
}
service dhcpd configtest
yum install httpd
vi /etc/httpd/conf/httpd.conf
ServerName 127.0.0.1:80
/etc/init.d/httpd start
ss -ntlp | grep 80
umount /mnt/
mount -o loop /data/CentOS-6.6-x86_64-bin-DVD1.iso /var/www/html/centos6/
vim /var/www/html/pxe-ks.cfg
# Kickstart file automatically generated by anaconda.
#version=DEVEL
install
url --url=http://192.168.1.108/centos6
lang zh_CN.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --noipv6
rootpw --iscrypted $6$k80gonzUBxLGIIOw$q2VJzcf5gqIbxhEJRdLzqHxWjW/b3z9KzpuQBRCnxGLxpOsluzwFUoUmJIV84Eptftp6J4zhgWem/p1Ug1tNt1
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --enforcing
timezone Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
reboot
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
zerombr
clearpart --all
part /boot --fstype=ext4 --asprimary --size=600
part / --fstype=ext4 --asprimary --size=10240
part swap --asprimary --size=2048
part /data --fstype=ext4 --grow --asprimary --size=200
repo --name="CentOS" --baseurl=http://192.168.1.108/centos6 --cost=100
%packages
@base
@chinese-support
@core
@british-support
@system-management-snmp
@server-policy
@system-admin-tools
@workstation-policy
python-dmidecode
sgpio
device-mapper-persistent-data
%end
vi /var/lib/tftpboot/pxelinux.cfg/default
末尾添加:
label pxe
menu label ^pxe
kernel vmlinuz
append initrd=initrd.img ks=http://192.168.1.108/pxe-ks.cfg
--------------------------------------------------------------------------------------
vi /var/lib/tftpboot/pxelinux.cfg/default 启动界面在这修改
default linux # 默认启动的是 'label linux' 中标记的启动内核
prompt 1 # 显示 'boot: ' 提示符
timeout 60 # 等待超时时间,单位为 1/10 秒,超时后自动启动 默认指定的label
display boot.msg # 显示boot.msg的内容,文件路径是相对tftp server 的根目录(默认 /tftpboot),所以boot.msg文件绝对路径在 /tftpboot/boot.msg
menu.c32 提供类菜单模式的功能
pxelinux.0 开机管理程式
pxelinuxcfg 开机的选单设定
vesamenu.c32 图形化界面菜单
vmlinuz 安装软件核心文档(kernel file)
initrd.img 开机过程所需要的模块参数
isolinux.cfg -->demo 作为pxe所需开机菜单
--size 规范分割的大小
--grow 系统自动去判断最大可用容量,然后通通分给该分区
--asprimary 将该分割强制列在主要分割类型中
--grub-crypt rootpw密码获取
part / --fstype ext3 --start=1 --end=250 --ondisk=sda 根分区类型、挂载点、大小
part /home --fstype ext3 --start=251 --end=1000 --ondisk=sda
part /usr --fstype ext3 --start=1001 --end=5000 --ondisk=sda
part /usr/local --fstype ext3 --start=5001 --end=7000 --ondisk=sda
%pre,%post 安装前、安装后的额外动作
%pre
#----创建raid---------#
#创建strip size 64k的raid0
megacli -cfglddel -L1 -a0
megacli -cfgldadd -r1[32:6,32:7] -wt -ra -strpsz64 -force -a0
megacli -CfgLdAdd -r0[14:2] wb ra Cached -strpsz64 -a0
megacli -cfgldadd -r5[0:2,0:3,0:4] -wb -ra Cached -strpsz64 -a0
%post
MegaCli-8.07.10-1.noarch