CentOS7 fully automatic installation CD production detailed explanation

Detailed explanation of making CentOS7 automatic installation CD

1 Copy CD files

1 ) Mount the iso image

Create a directory for mounting the CD:

mkdir /root/centos7

Mount the iso image

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

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

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

First create the editing directory:

mkdir /root/centos7_iso

Copy CD files:

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

The diskinfo file needs to be copied separately:

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

2 Edit the ks.cfg file

When the system is installed, install according to the content of the ks.cfg file. We put the ks.cfg file in the isolinux directory:

cd /root/centos7_iso/isolinux
vim ks.cfg

The content of my ks.cfg file is as follows:

# version=RHEL/CentOS7 by xiaoli110
install
# Keyboard layouts
keyboard 'us'
# Reboot after installation
reboot
# 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
cdrom
# Use graphical install
graphical
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# 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%packages
@ base
@ core
@ development
@ hardware-monitoring
@ performance
@ remote-system-management
%end

note:

1 ) Because the network card rules of the CentOS7 system are more complicated, in order to make ks.cfg more general, it is better not to make the network card configuration for ks.cfg.

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

3 Configure mbr boot mode

Edit the isolinux.cfg file in the isoliuux directory, add your own content, and add your own label under label linux in the isolinux.cfg file:

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

be careful:

1 ) The content after memu label is the content of the menu when the CD is booted, and the letter after ^ is the shortcut key of the menu;

2 ) Specify the location of the ks.cfg file through the inst.ks keyword;

3 ) Inst.stages2 identifies the location of the system according to the media. Here, hd:LABEL is used to indicate that you are looking for the installation media whose label is CENTOS7. The advantage of using the LABEL keyword is that you can precisely specify the installation media. Why is the label CENTOS7? The method is specified when making the CD image, and the method is introduced later.

4 Configure EFI boot method

1 ) Introduction to EFI

EFI Extensible Firmware Interface (abbreviation for ExtensibleFirmware Interface) is an upgrade program that replaces BIOS launched by Intel. It was first developed by Intel. In 2005, this specification format was handed over to the UEFI Forum for promotion and development. Later, the name was changed to Unified EFI (UEFI). The UEFI Forum released and released the 2.1 version of the specification on January 7, 2007, which added and improved encryption, network authentication, and user interface architecture.

EFI is a system built with modularization, C language style parameter stack transfer, and dynamic linking. It is easier to implement than BIOS, has stronger fault tolerance and error correction characteristics, and shortens the time for system development.

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

2 ) Configure EFI boot

Enter the CD-ROM directory EFI/BOOT/, edit the grub.cfg file, and add your own menu:

menuentry 'Install CentOS 7'--classfedora--classgnu-linux --classgnu--classos{
  linuxefi /p_w_picpaths/pxeboot/vmlinuz inst.stage2=hd:LABEL=CENTOS7 quiet
  initrdefi /p_w_picpaths/pxeboot/initrd.img
}
menuentry 'Install CentOS 7 custom byxiaoli110'--classfedora--classgnu-linux --classgnu--classos{
  linuxefi /p_w_picpaths/pxeboot/vmlinuz inst.ks=cdrom:/isolinux/ks.cfginst.stage2=hd:LABEL=CENTOS7 quiet
  initrdefi /p_w_picpaths/pxeboot/initrd.img
}

Similar to the mbr method, specify the location of the ks.cfg file and the location of the installation source.

5 Generate iso image

After I stepped on many pits, I successfully generated the image, and the image generation command that can be installed in the EFI and mbr environment is as follows:

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

(1) Several pits stepped on in the middle:

1 ) To make the image, use the CentOS7 system, not the CentOS6 system, because the versions of the genisop_w_picpath command of the two systems are different, and the iso produced by the 6 system cannot be started in the efi environment;

2 ) If you want to start on efi, you need to add the following parameters:

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

3 ) Specify the disc label through the -V parameter

(2) Introduction to genisop_w_picpath command parameters

(3) The difference between genisop_w_picpath, mkisofs, and xorrios commands

Speaking of genisop_w_picpath and mkisofs, there is actually a bit of a story inside.

In the earliest days, Linux systems used cdrtools to manage iso and CD-ROMs. mkisofs was a tool in cdrtools. Later, cdrtools got a better license, changed from GPL to CDDL, and the open source community released a set of tools based on GPL. , Cdrkit, mkisofs are also removed by genisop_w_picpath, now mkisofs in the system is actually a soft link of genisop_w_picpath:

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

Xorrios is another popular tool for making iso images, and there is a parameter -asmkisofs that is compatible with the mkiso command.

Recommended Posts

CentOS7 fully automatic installation CD production detailed explanation
Graphical centos installation detailed process
Detailed explanation of Spark installation and configuration tutorial under centOS7
CentOS 8 installation of MariaDB detailed tutorial
CentOS6 minimal installation KVM detailed tutorial
Centos8 installation diagram (super detailed tutorial)
Centos 7 RAID 5 detailed explanation and configuration
Centos7.5 configuration java environment installation tomcat explanation
2019-07-09 CentOS7 installation
centos7_1708 installation
Centos7 installation and deployment of Airflow detailed
CentOS 6.5 system installation and configuration graphic tutorial (detailed graphic)
Centos7 installation of PHP and Nginx tutorial detailed
CentOS7 Docker Nginx deployment and operation detailed explanation
MySQL 8.0 installation and deployment under CentOS, super detailed!
Detailed explanation of building Hadoop environment on CentOS 6.5
Centos5 installation guide
Python - centos6 installation
Docker installation (CentOS7 installation)
CentOS7 docker installation
Detailed explanation of Centos 7 system virtual machine bridging mode
Detailed installation steps of CentOS6.4 system in virtual machine
Equal Insurance Evaluation: Detailed Explanation of Centos Timeout Exit
Detailed explanation of CentOS7 network setting tutorial in vmware
Detailed tutorial on installing JDK8 on Linux system (CentOS7 installation)