Making the CD of CentOS automatic installation on Windows


1 copy CD files

1) Mount ISO image

To create a directory for mounting a CD:

Copy code

The code is as follows:

mkdir /root/centos7

Mount ISO image

Copy code

The code is as follows:

mount -o loop CentOS-7.0-1406-x86_64-DVD.iso/root/centos7

2) Copy the CD file to the edit directory for editing

Because mounting an ISO image is read-only, if you want to edit it, you need to copy the file and edit it again.

First, create the edit directory

Copy code

The code is as follows:

mkdir /root/centos7_iso

To copy a disc file:

Copy code

The code is as follows:

cp -rf /root/centos7/* /root/centos7_iso/

Diskinfo file needs to be copied separately

Copy code

The code is as follows:

cp /root/centos7/.discinfo /root/iso

2 editing ks.cfg file

When installing the system, follow the ks.cfg To install the contents of the file, we ks.cfg Put the file in the isolinux Directory:

Copy code

The code is as follows:

cd /root/centos7_iso/isolinux
vim ks.cfg

my ks.cfg The contents of the document are as follows:

Copy code

The code is as follows:

#version=RHEL/CentOS7 by xiaoli110
# Keyboard layouts
keyboard ‘us’
# Reboot after installation
# Run the Setup Agent on first boot
firstboot –enable
ignoredisk –only-use=sda
# Keyboard layouts
keyboard –vckeymap=us –xlayouts=’cn’
# System language
lang zh_CN.UTF-8
# Network information
#network –bootproto=dhcp –device=enp2s0 –onboot=off –ipv6=auto
#network –bootproto=dhcp –device=enp3s0 –onboot=off –ipv6=auto
#network –hostname=localhost.localdomain
# Root password
rootpw –iscrypted 111111111111111111111111111
# System timezone
timezone Asia/Shanghai
# System language
lang zh_CN
# Firewall configuration
firewall –enabled –ssh

# System authorization information
auth –useshadow –passalgo=sha512
# Use CDROM installation media
# Use graphical install
# SELinux configuration
selinux –disabled
# Do not configure the X Window System
# System bootloader configuration
bootloader –location=mbr
# Clear the Master Boot Record
# Partition clearing information
clearpart –all
# Disk partitioning information
part /boot –fstype=”xfs”–size=500
part /boot/efi –fstype=”xfs”–size=500
part swap –fstype=”swap”–size=16000
part / –fstype=”xfs” –grow–size=1



be careful:

1) Because the network card rules of centos7 system are more complex, in order to ks.cfg More general, better ks.cfg There is no need to make network card configuration.

2) In order to be compatible with MBR mode and EFI mode, the / boot and / boot / EFI partitions are created at the same time.

3. Configure MBR boot mode

Edit the isolinux.cfg File, add your own content in isolinux.cfg Add your own label under the label Linux File:

Copy code

The code is as follows:

label linux
menu label ^Install CentOS 7
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=CENTOS7 quiet

label custom
menu label ^Custom CentOS 7 by xiaoli110
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=CENTOS7 inst.ks=cdrom:/isolinux/ks.cfg


1) The contents behind the memu label are the contents of the menu guided by the CD, and the letters behind ^ are the shortcut keys of the menu;

2) Through inst.ks Keyword indication ks.cfg File location;

3) inst.stages2 It indicates that the system is based on the media location. Using HD: label here indicates that it is looking for the installation media with label as centos7. The advantage of using the label keyword is that it can accurately specify the installation media. Why label is centos7 is because I specified it when I made the disc image. The method is described later.

4. Configure EFI boot mode

1) Introduction to EFI

EFI extensible firmware interface (abbreviated as extensible firmware interface) is a kind of upgrade scheme which is led by Intel to replace BIOS. It was first developed by Intel. In 2005, it was handed over to UEFI forum for promotion and development. Later, it was changed to unified EFI (UEFI). UEFI forum released and released version 2.1 specification on January 7, 2007, which added and improved cryptography, network authentication and user interface architecture.

EFI is a modular, C language style parameter stack transfer mode, dynamic link form of the system. Compared with BIOS, EFI is easier to implement, with stronger fault tolerance and error correction characteristics, which shortens the time of system development.

EFI is very similar to a low-level operating system in concept, and has the ability to control all hardware resources.

2) Configure EFI boot

Enter EFI / boot /, edit grub.cfg File, add your own menu:

Copy code

The code is as follows:

menuentry ‘Install CentOS 7’ –class fedora–class gnu-linux –class gnu –class os {
linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CENTOS7 quiet
initrdefi /images/pxeboot/initrd.img
menuentry ‘Install CentOS 7 custom byxiaoli110’ –class fedora –class gnu-linux –class gnu –class os {
linuxefi /images/pxeboot/vmlinuz inst.ks=cdrom:/isolinux/ks.cfginst.stage2=hd:LABEL=CENTOS7 quiet
initrdefi /images/pxeboot/initrd.img

Similar to MBR, it indicates that ks.cfg File location and installation source location.

5 generate ISO image

After I stepped on several pits, I successfully generated the image, and the image generation commands that can be installed in EFI and MBR environments are as follows:

Copy code

The code is as follows:

genisoimage -v -cache-inodes -joliet-long -R -J -T -V CENTOS7 -o /root/centos7.iso \
-c isolinux/ -bisolinux/isolinux.bin \
-no-emul-boot -boot-load-size 4-boot-info-table \
-eltorito-alt-boot -b images/efiboot.img -no-emul-boot .


(1) Several pits in the middle:

1) The system of centos7 should be used for image making, not centos6, because the versions of geniseimage command of the two systems are different, and the ISO produced by the system of centos6 cannot be started in EFI environment;


2) If you want to start in EFI, you need to add the following parameters:


Copy code

The code is as follows:

-eltorito-alt-boot -bimages/efiboot.img -no-emul-boot

3) Specify the disc label with the – V parameter


(2) Brief introduction of genisoimage command parameters

-O specify the name of the image file.

-B specifies the boot image file required for making bootable CD.

-When making bootable CD-ROM, C will make all the contents of no eltorito catalog in boot image file into a file.

-No emul boot mode.

-Boot load size 4 sets the number of load parts.

-Boot info table displays real information in the boot image.

-Joliet long uses Joliet format directory and file name, long file name support.

-R or – rock use rock ridgeextensions.

-J or – Joliet use directory and file names in Joliet format.

-Detailed information is displayed when V or – verb is executed.

-T or – translation table, which is suitable for systems that do not support Rock Ridge extensions.

(3) The difference between genisoimage, mkisofs and xorrios

Speaking of genisoimage and mkisofs, there are some stories in them.

In the early days, the Linux system used cdrtools to manage ISO and CDs. Mkisofs was a tool in cdrtools. Later, cdrtools changed its license from GPL to CDDL. The open source community launched a set of tools based on GPL. Cdrmit and mkisofs were also removed from genisoimage. Now mkisofs in the system is actually a soft connection of genisoimage

Copy code

The code is as follows:

ls -l /usr/bin/mkisofs
/usr/bin/mkisofs ->/etc/alternatives/mkisofs
ls -l /etc/alternatives/mkisofs
/etc/alternatives/mkisofs ->/usr/bin/genisoimage

Xorrios is another popular tool for making ISO image, and has a parameter asmkisofs, which is compatible with mkiso command.

Recommended Today

Practice of query operation of database table (Experiment 3)

Following the previous two experiments, this experiment is to master the use of select statements for various query operations: single table query, multi table connection and query, nested query, set query, to consolidate the database query operation.Now follow Xiaobian to practice together!Based on the data table (student, course, SC, teacher, TC) created and inserted in […]