制作Linux安装光盘

来源:互联网 发布:校园网端口初始化失败 编辑:程序博客网 时间:2024/06/02 15:30

一.CD -> DVD
1. mkdir -p /mnt/disk{1,2,3,4,5}
   ;以 root 权限在 /mnt 目录下分别建立出 disk1 ~ disk5 目录
2. mount -o loop RHEL4-U4-x86_64-AS-disc1.iso /mnt/disk1   
   ;五个影像文件分别加载 disk1 ~ disk 5 目录中
3. mount -o loop RHEL4-U4-x86_64-AS-disc2.iso /mnt/disk2
4. mount -o loop RHEL4-U4-x86_64-AS-disc3.iso /mnt/disk3
5. mount -o loop RHEL4-U4-x86_64-AS-disc4.iso /mnt/disk4
6. mount -o loop RHEL4-U4-x86_64-AS-disc5.iso /mnt/disk5
7. mkdir -p /data/isobuild   
   ;在根目录下建立 /data/isobuild 目录
8. rsync -rv /mnt/disk{5,4,3,2,1}/* /data/isobuild/   
   ;透过 rsync 将 disk1 ~ disk5 目录数据同步至 /data/isobuild 目录内
9. cp /mnt/disk1/.diskinfo /data/isobuild/   
   ;将 /disk1 下的 .diskinfo 复制到 /data/isobuild 目录内
10. vim .diskinfo
   ;将第 4 行原本的 1 更改为 1,2,3,4,5
11. chmod a+w /data/isobuild/isolinux/isolinux.bin   
   ;变更 isolinux.bin 权限
12. mkisofs -r -T -J -V “Custom RHEL4 Build” -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o
/data/custom-RHEL4-dvd.iso /data/isobuild/   
   ;制作影像文件,其中光盘卷标为 Custom RHEL4 Build,影像文件名为 custom-RHEL4-dvd.iso
13. cdrecord -v speed=4 dev=0,0,0 /data/custom-RHEL4-dvd.iso   
   ;透过 cdrecord 将影像文件以四倍速度烧录,其中 dev=0,0,0 可以透过 cdrecord -scanbus 指令来看刻录机是在哪一个位置。


二.改造RHEL5光盘用于YUM源(RHEL5的光盘直接用于YUM源时总是报错)
[root@minot kook]# mkdir foo rhel5
[root@minot kook]# ls
Desktop  foo  rhel5  rhel-5.1-server-i386-dvd.iso
[root@minot kook]# mount rhel-5.1-server-i386-dvd.iso foo -o loop
[root@minot kook]# cp -r foo/* rhel5
[root@minot kook]# cp foo/.discinfo rhel5
[root@minot kook]# rm rhel5/{Server,VT,Cluster,ClusterStorage}/repodata -rf
[root@minot kook]# createrepo -g ~kook/foo/Server/repodata/comps-rhel5-server-core.xml ./rhel5/Server/
[root@minot kook]# createrepo -g ~kook/foo/VT/repodata/comps-rhel5-vt.xml ./rhel5/VT
[root@minot kook]# createrepo -g ~kook/foo/Cluster/repodata/comps-rhel5-cluster.xml ./rhel5/Cluster
[root@minot kook]# createrepo -g ~kook/foo/ClusterStorage/repodata/comps-rhel5-cluster-st.xml ./rhel5/ClusterStorage/
[root@minot kook]# mkisofs -r -T -J -V "Custom RHEL5 Build BY" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /home/kook/rhel5.iso /home/kook/rhel5
[root@minot kook]# file rhel5.iso
rhel5.iso: ISO 9660 CD-ROM filesystem data 'Custom RHEL5 Build BY KOOK LIU ' (bootable)
[root@minot kook]# /usr/lib/anaconda-runtime/implantisomd5 /home/kook/rhel5.iso
Inserting md5sum into iso image...
md5 = 3063799e4be0e1b9b315b50455a060d9
Inserting fragment md5sums into iso image...
fragmd5 = fc8a2252cbebe9e833ed9e873d7daf4f2ddcc11612e1e48fe886d9bd7823
frags = 20
Setting supported flag to 0
[root@minot kook]# md5sum rhel5.iso
aa130b630c5c83782bcd2662879cb527  rhel5.iso
[root@minot kook]# mv rhel5.iso rhel5-update1-dvd.iso




How to make your own RedHat 8.0 DVD from the CD ISO images

Red Hat has finally created a DVD version of their distribution for US
consumers. (They've had one in Europe for a while, I understand.)
For 8.0, though, it seems that you have to buy RedHat 8.0 Professional
to get the DVD, and RedHat is not presently offering an ISO image of
the DVD for download.

After reading some of the anaconda source code, I have figured out how
you can make your own DVD from the CD ISO images. I've done this,
written it to a DVD+RW disc, had it pass its Media check, and
successfully installed from it.

The idea is simple, which is a testament to the flexibility of Red
Hat's installation system. There's a file on the root of each CD
called .discinfo that contains information including which discs'
contents are represented. The CDs each contain only a single number
here, but the installation software will accept a comma-separated list
of numbers. The sequence of commands below will create an ISO image
that consists of the combined contents of the five discs + the
documentation disc (in a docs subdirectory) and is bootable and
suitable for being installed from. If you don't care about docs, omit
the docs/=Psyche-docs argument, and don't bother with the docs ISO.
If you don't care about sources, omit the SRPMS/= arguments and
dispense with discs 4 and 5.

These instructions require you to have enough disk space for the
resulting ISO image, but if you have a DVD burner and don't care about
installing the media checksum so that you can test the media from
install (not really that important if you have verified the checksums
of the original images, unless you're concerned about errors resulting
from the actual DVD creation process itself), you can pipe the output
of mkisofs directly to your burning software and not worry about the
intermediate disk space.

So here are the steps. These steps create a DVD image that is usable
from a Unix system. Add the -J and -T flags to the mkisofs command if
you want something that you can read from Windows as well. Add
-V "Label" if you want to create a volume label.

1. Go to a place on your drive with about 3.5 GB free. This is
needed for the final ISO image only. You'll need a 2.4 kernel to
create a file > 2 GB. If you're running Red Hat, This works on a
7.1 system or newer.

2. Create directories on which to mount the ISO images using loop
device mounts:

mkdir Psyche-i386-disc{1,2,3,4,5} Psyche-docs

3. Mount the ISO images using a loop device mount:

mount -o ro,loop .../Psyche-i386-disc1.iso Psyche-i386-disc1
mount -o ro,loop .../Psyche-i386-disc2.iso Psyche-i386-disc2
# etc. -- repeat for the remaining discs that you want
# Replace ... with the path to your ISO images.

4. Copy the isolinux directory and the .discinfo from disc1 to the
current directory:

cp -a Psyche-i386-disc1/isolinux Psyche-i386-disc1/.discinfo .

5. Edit the .discinfo file, replacing the fourth line with 1,2,3,4,5
if you are creating an image with all five discs or with 1,2,3 if
you are just using the three install discs.

6. Create the iso image. I'm separating this mkisofs command into
multiple lines ending with / for clarity. You can type it that
way or as a long command. I explain this command at the end.

mkisofs -o Psyche-i386-dvd.iso /
-b isolinux/isolinux.bin -c isolinux/boot.cat /
-no-emul-boot -boot-load-size 4 -boot-info-table /
-R -m TRANS.TBL /
-x Psyche-i386-disc1/.discinfo -x Psyche-i386-disc1/isolinux /
-graft-points Psyche-i386-disc1 .discinfo=.discinfo isolinux/=isolinux /
RedHat/=Psyche-i386-disc2/RedHat RedHat/=Psyche-i386-disc3/RedHat /
SRPMS/=Psyche-i386-disc3/SRPMS SRPMS/=Psyche-i386-disc4/SRPMS /
SRPMS/=Psyche-i386-disc5/SRPMS docs/=Psyche-docs

7. (Optional) If you want to create a media checksum for the
installation software to look at when you do a media test during
install, then following these additional steps:

a. Install the anaconda source rpm located on disc5 and cd /usr/src/redhat

b. Comment out the BuildPreReq line in SPECS/anaconda.spec

c. Run rpmbuild -bp SPECS/anaconda.spec

d. Go to BUILD/anaconda-8.0/isomd5sum

e. Run "make"

f. Run ./implantisomd5 .../Psyche-i386-dvd.iso (where ... is
replaced with the path to your new ISO image). This step
will take several minutes and not provide any feedback while
it runs.

Now burn the resulting ISO image to a DVD.

Here's the mkisofs command explained:

# Write the output to Psyche-i386-dvd.iso
mkisofs -o Psyche-i386-dvd.iso /

# Set up the DVD to be bootable using an El Torito boot image.
# This comes from the RELEASE_NOTES file on disc 1.
-b isolinux/isolinux.bin -c isolinux/boot.cat /
-no-emul-boot -boot-load-size 4 -boot-info-table /

# Use Rock ridge extensions (to support long file names, etc.).
# Exclude all TRANS.TBL files on the original disc. If you want
# to access this disc from Windows, add -J to create Joliet
# extensions and -T to create new TRANS.TBL files in place of
# the ones you're omitting.
-R -m TRANS.TBL /

# Omit the .discinfo and isolinux files from disc1
-x Psyche-i386-disc1/.discinfo -x Psyche-i386-disc1/isolinux /

# Use Psyche-i386-disc1 (minus above exclusions) as the root.
# Graft the .discinfo and isolinux directories from the current
# directory to .discinfo and isolinux on the new disc. Also
# graft in the RedHat and SRPMS directories from the remaining
# discs. Include the entire contents of the docs disc in the
# docs subdirectory.
-graft-points Psyche-i386-disc1 .discinfo=.discinfo isolinux/=isolinux /
RedHat/=Psyche-i386-disc2/RedHat RedHat/=Psyche-i386-disc3/RedHat /
SRPMS/=Psyche-i386-disc3/SRPMS SRPMS/=Psyche-i386-disc4/SRPMS /
SRPMS/=Psyche-i386-disc5/SRPMS docs/=Psyche-docs