CentOS6 Disc Merge

Keywords: RPM CentOS yum Unix

Introduction: Systems before CentOS6 and CentOS6 will store the system on two discs, DVD1 and DVD2. DVD1 can be used to install the operating system. System installation package files are stored in DVD1 and DVD2 respectively.
When installing software using local yum sources, if you only use the package files on one disc, the installation may fail due to dependency problems.To solve this problem, we need to merge the package files from the two discs into one disc.But if we copy the files from the two discs directly into a folder and then make an ISO file, then the ISO file will not be available as an installation disc, how can we make it into a system that can be installed as well as a package that can be merged together as EnOS7?

Related catalogs and roles

Environment: This experiment is performed on a virtual machine
Operating System: Centos7.3
Catalog:
/mnt/dvd1 and/mnt/dvd2 for mounting Centos mirrors
/mnt/dvd3 merged mirror file
/mnt/iso ISO storage

Detailed steps

1. Create related directories

mkdir -p /mnt/dvd1 /mnt/dvd2 /mnt/dvd3 /mnt/iso

2. Mount the disc into the system

Set up two drives in the virtual machine and put two disc files into two drives

The device name of the disc in the system is/dev/sr0,/dev/sr1.

[root@CentOS7 ~]#ls /dev/sr*
/dev/sr0 #Found only sr0

Then it needs to be restarted, but we all know that restarting is not a good thing, let alone say you understand ^^.
So what to do? Note that the type of the new CD-ROM drive above the screenshot is scsi, which means you can scan the SCSI device with the following code

echo '- - -' >  /sys/class/scsi_host/host0/scan
echo '- - -' >  /sys/class/scsi_host/host1/scan
echo '- - -' >  /sys/class/scsi_host/host2/scan
#Any of the three commands can be scanned. If they can't be scanned, switch to another command, which will always be scanned.
[root@CentOS7 ~]#ls /dev/sr*
/dev/sr0  /dev/sr1 #Found that sr1 has been scanned, then you can mount it

Mount discs sr0 and sr1

[root@CentOS7 ~]#mount /dev/sr0 /mnt/dvd1
mount: /dev/sr0 is write-protected, mounting read-only

[root@CentOS7 ~]#mount /dev/sr1 /mnt/dvd2
mount: /dev/sr1 is write-protected, mounting read-only
#Show folders inside
[root@CentOS7 ~]#tree -L 1 /mnt/dvd1
/mnt/dvd1
├── CentOS_BuildTag
├── EFI
├── EULA
├── GPL
├── images
├── isolinux
├── Packages
├── RELEASE-NOTES-en-US.html
├── repodata
├── RPM-GPG-KEY-CentOS-6
├── RPM-GPG-KEY-CentOS-Debug-6
├── RPM-GPG-KEY-CentOS-Security-6
├── RPM-GPG-KEY-CentOS-Testing-6
└── TRANS.TBL

5 directories, 9 files
[root@CentOS7 ~]#tree -L 1 /mnt/dvd2
/mnt/dvd2
├── CentOS_BuildTag
├── EULA
├── Packages
├── RPM-GPG-KEY-CentOS-6
├── RPM-GPG-KEY-CentOS-Debug-6
├── RPM-GPG-KEY-CentOS-Security-6
├── RPM-GPG-KEY-CentOS-Testing-6
└── TRANS.TBL

1 directory, 7 files


3. Copy files

First, copy all the files from the first DVD to the / mnt/dvd3 directory, then copy only all the RPM files from the Packages directory in the second DVD to the / mnt/dvd3/Packages directory

cp  -av  /mnt/dvd1/*  /mnt/dvd3 
cp  -v  /mnt/dvd2/Packages/*.rpm  /mnt/dvd3/Packages/

4. Merge TRANS.TBL

Append the information of TRANS.TBL in DVD2 to the back of TRANS.TBL in DVD1 and save it in order

cat  /mnt/dvd2/Packages/TRANS.TBL  >> /mnt/dvd3/Packages/TRANS.TBL 
mv  /mnt/dvd3/Packages/{TRANS.TBL,TRANS.TBL.BAK} 
sort  /mnt/dvd3/Packages/TRANS.TBL.BAK  >  /mnt/dvd3/Packages/TRANS.TBL 
rm  -rf  /mnt/dvd3/Packages/TRANS.TBL.BAK

dvd3 is already a consolidated file that can be used as a local source and for ISO use

TRANS.TBL files, which record file names in directories, were widely used by unix-like systems in the early days.
This file is used when installing the system, so keep it.
Wikipedia has a detailed explanation above, because the vast Chinese people can't turn over the wall. Please post a picture here. If you are interested, you can read English in Wikipedia.

5. Generate ISO files

mkisofs -r -o /root/CentOS-6.9-x86_64-Everythings.iso /mnt/dvd3

An ISO file will be generated.By the time this ISO file has been created, you can either use it as a source of yum or install the operating system. If you don't believe it, you can try it.
If there are any errors, please give more advice!^^

Posted by DJ Judas on Wed, 19 Jun 2019 09:55:58 -0700