- 定制livecd
安装宿主系统(系统分区不能使用LVM)安装livcd-tools
创建文件/etc/yum.repos.d/centos-livecd.repo内容如下:
# Name: CentOS LiveCD repository
[livecd]name = CentOS $releasever - LiveCD
baseurl = http:///propos/linux/centos-live/$basearch/live
enabled=1
protect=0
gpgkey = http:///propos/linux/RPM-GPG-KEY-PGuay2010
安装
yum install livecd-tools syslinux anaconda-runtime
#创建配置文件mini.ks
# Kickstart file automatically generated by anaconda.
#cdrom
repo --name=base --baseurl=
#repo --name=a-base --baseurl=
#repo --name=a-updates --baseurl=
#repo --name=a-extras --baseurl=
#repo --name=a-live --baseurl=http:///propos/linux/centos-live/$basearch/live
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto dhcp --hostname minnicentos
authconfig --enableshadow --enablemd5
selinux --disabled
firewall --disabled
timezone --utc Asia/Shanghai
# 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
%packages
bash
kernel
syslinux
passwd
policycoreutils
chkconfig
authconfig
rootfiles
comps-extras
xkeyboard-config
openssh-server
net-tools
vim-minimal
netpbm
#netpbm-progs
nfs-utils-lib
nfs-utils
portmap
rsync
libdhcp4client
libdhcp
运行命令创建mini-livecd
livecd-creator --config=anaconda-ks.cfg --fslabel=CentOS-minimalls
生成pxe boot启动用的系统
livecd-iso-to-pxeboot 把产生的initrd0.img,vmlinuz0两个文件放到分发服务器的/tftpboot下
2. 准备一台分发服务器上面安装 tftp-server , dhcp, NFS
配置修改 /etc/xinetd.d/tftp
disable yes改成 NO
复制系统下/usr/lib/syslinux/pxelinux.0,menu.c3 到 /tftpboot
cat << EOF > /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
default-lease-time 21600;
max-lease-time 43200;
authourtative;
next-server 192.168.56.101;
subnet 192.168.56.0 netmask 255.255.255.0 {
option routers 192.168.56.1;
option subnet-mask 255.255.255.0;
range 192.168.56.50 192.168.56.100;
default-lease-time 21600;
max-lease-time 43200;
filename "pxelinux.0";
option domain-name-servers 127.0.0.1 ;
}
EOF
在/tftpboot/下 创建如下两个文件
cat << EOF > defalutdefault menu.c32
prompt 0
timeout 300
ONTIMEOUT local
MENU TITLE Boot from network
LABEL local
MENU LABEL Boot local hard drive
LOCALBOOT 0
LABEL x86 Servers
MENU LABEL Install Linux with MinLinx
KERNEL menu.c32
APPEND pxelinux.cfg/min
LABEL x86_64 Servers
MENU LABEL Install Linux with Kickstart
KERNEL menu.c32
APPEND pxelinux.cfg/kick
LABEL Tools
MENU LABEL Windows2003 server
KERNEL menu.c32
APPEND pxelinux.cfg/windows
EOF
########################################
cat << EOF > min
MENU TITLE Min install Server Menu
LABEL Main Menu
MENU LABEL Min Install Menu
KERNEL menu.c32
APPEND pxelinux.cfg/default
LABEL CentOS 5 x86_64 NO KS eth0
MENU LABEL CentOS 5 x86_64 NO KS eth0
KERNEL vmlinuz0
APPEND initrd=initrd0.img root=/CentOS-minimal.iso rootfstype=iso9660 rootflags=loop
LABEL CentOS 5 x86_64 NO KS eth1
MENU LABEL CentOS 5 x86_64 NO KS eth1
KERNEL images/centos/5/x86_64/vmlinuz
APPEND ks initrd=images/centos/5/x86_64/initrd.img ramdisk_size=100000 ksdevice=eth1 ip=dhcp url --url
EOF
3.自动安装系统
- 服务器网络启动选择mini os,进入livecd
- 用fdisk 格式化 /dev/sda 两个区一个boot 区 一个 / 分区,根分区做成lvm
- 然后mount / 分区
- 用dd if=/dev/源分区 of=/dev/目的分区
- 用rsync 把 /目录下的内容 同步到分到区的 / 目录中。
阅读(1316) | 评论(0) | 转发(0) |