1 准备工作
a> CentOS 系统镜像 : CentOS-6.2-x86_64-bin-DVD.iso
b> 8G U盘一个
c> centso5.0系统的vesamenu.c32 文件
d> windows系统下使用的syslinux.exe
e> centos的自动配置文件ks_centos.cfg
2 格式化u盘,将u盘分为两个区 --500M的vfat 和 其他的ext2
sudo fdisk /dev/sdb
sudo mkfs.vfat /dev/sdb1
sudo mkfs.ext2 /dev/sdb2
3 复制文件
a> sudo mount /dev/sdb1 /mnt/sdb1
sudo mount /dev/sdb2 /dev/sdb2
sudo mount -o loop CentOS-6.2-x86_64-bin-DVD.iso /mnt/cen
b> sudo cp -r /men/cen/images /mnt/sdb2
sudo cp CentOS-6.2-x86_64-bin-DVD.iso /mnt/sdb2
c> sudo cp -r /mnt/cen/isolinux /mnt/sdb1/syslinux
sudo mv /mnt/sdb1/syslinux/isolinux.cfg /mnt/sdb1/syslinux/syslinux.cfg
sudo cp vesamenu.c32 /mnt/sdb1/syslinux/ (覆盖centos6.2的vesamenu.c32文件,否则卡在 press the enter 界面)
d> sudo cp ks_centos /mnt/sdb1/
e> sudo cp syslinux.exe /mnt/sdb1
4 编辑配置
a> vim /mnt/sdb1/syslinux/syslinux.cfg
修改内容
label linux
menu label ^Install or upgrade an existing system
menu default
kernel vmlinuz
append ks=hd:sda1:/ks_centos.cfg initrd=initrd.img
b> 在windos 系统下 进入u盘目录I
syslinux.exe -m -a I:
生成系统文件ldlinux.sys
5 制作完成
附: ks_centos 文件内容
vim ks_cnetos
- install
-
- text
-
- #url –url=ftp://192.168.68.254/centos
-
- harddrive –partition=sda2 –dir=
-
- lang en_US.UTF-8
-
- keyboard us
-
- network –device eth0 –bootproto dhcp
-
- rootpw –iscrypted $1$JNve6BUI$Ivm.MDR3QnxIn8yeZQD0h0
-
- firewall –disabled
-
- authconfig –enableshadow –enablemd5
-
- selinux –disabled
-
- timezone –utc Asia/Shanghai
-
- bootloader –location=mbr –driveorder=sdb –append=”rhgb crashkernel=auto quiet”
-
- # 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
-
- clearpart –all –drives=sdb –initlabel
-
- part /boot –fstype ext3 –size=100 –ondisk=sdb
-
- part swap –size=256 –ondisk=sdb
-
- part / –fstype ext3 –size=1 –grow –asprimary
- #volgroup VolGroup00 –pesize=32768 pv.2
-
- #logvol swap –fstype swap –name=LogVol01 –vgname=VolGroup00 –size=1024 –grow –maxsize=2048
-
- #logvol / –fstype ext3 –name=LogVol00 –vgname=VolGroup00 –size=1024 –grow
-
- %packages
-
- openssh-server
-
- vim
-
- %post –interpreter=/bin/bash
-
- rm -rf /etc/yum.repos.d/*
-
- echo ‘[centos6]
-
- name=centos6
-
- baseurl=ftp://192.168.68.254/centos
-
- enabled=1
-
- gpgcheck=0
-
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6′ > /etc/yum.repos.d/centos6.repo
-
- %end