How to create a fully automatic installation CD for CentOS 7.0

Source: Internet
Author: User

How to create a fully automatic installation CD for CentOS 7.0

How to create a fully automatic installation CD for CentOS 7.0

1. Copy the CD File

1) attach an iso Image

Create a directory for attaching a CD:
Mkdir/root/centos7

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

2) copy the CD file to the editing directory for editing.

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

First, create the editing directory:
Mkdir/root/centos7_iso

Copy a CD file:
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

During system installation, install the ks. cfg file according to the content of the ks. cfg file. We put the ks. cfg file under 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 nic Rules of CentOS7 are more complex, it is recommended that you do not need to configure Nic for ks. cfg to be more common.

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

3. Configure mbr Boot Mode

Edit the isolinux. cfg file under 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 m
Menu label ^ Custom CentOS 7 by xiaoli110
Kernel vmlinuz
Append initrd = initrd. img inst. stage2 = hd: LABEL = CENTOS7 inst. ks = cdrom:/isolinux/ks. cfg

Note:

1) the content behind the memu label is the content of the boot menu on the CD, and the letter behind the ^ is the shortcut key of the menu;

2) use the inst. ks keyword to specify the location of the ks. cfg file;

3) inst. stages2 identifies the system according to the media location. Here hd: LABEL indicates that the system is looking for the installation media whose label is CENTOS7. The advantage of using the LABEL keyword is that the installation media can be precisely specified, the reason why the label is CENTOS7 is because it was specified when I made the CD image. The method is described later.

4. Configure the EFI Boot Mode

1) Introduction to EFI

The extended EFI firmware Interface (ExtensibleFirmware Interface) is an Intel-led update solution that replaces the BIOS. It was first developed by Intel. In 2005, the standard format was submitted to the UEFI forum for promotion and development. Later, it was renamed as uniied EFI (UEFI ). The UEFI Forum released and released version January 7, 2007 on September 10, 2.1, which added and improved encryption (cryptography), network authentication (network authentication), and User Interface Architecture (User Interface Architecture ).

EFI is a modular, C-language parameter stack transfer method. It is built in the form of dynamic links, which is easier to implement than BIOS, and has better fault tolerance and error correction features, this shortens system R & D time.

In concept, EFI is very similar to a low-level operating system and can manipulate all hardware resources.

2) configure the EFI boot

Go to the CD directory EFI/BOOT/, edit the grub. cfg file, and add your own menu:
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 specifies the ks. cfg file location and installation source location.

5. generate an iso Image

After I step on too many pitfalls, the image is successfully generated, and the command for generating images that can be installed in the EFI and mbr environments is as follows:
Genisoimage-v-cache-inodes-joliet-long-R-J-T-V CENTOS7-o/root/centos7.iso \
-C isolinux/boot. cat-bisolinux/isolinux. bin \
-No-emul-boot-load-size 4-boot-info-table \
-Eltorito-alt-boot-B images/efiboot. img-no-emul-boot.

(1) several pitfalls that have been stepped on in the middle:

1) To create an image, use CentOS7 instead of CentOS6. Because the genisoimage command versions of the two systems are different, the iso produced by system 6 cannot be started in the efi environment;

2) To start efi, add the following parameters:
-Eltorito-alt-boot-bimages/efiboot. img-no-emul-boot

3) Specify the disc label using the-V Parameter

(2) genisoimage Command Parameters

-O specifies the image file name.

-B: Specify the boot image file required when you create a boot disc.

-C when you create a boot disc, all the content of no-eltorito-catalog in the boot image file will be made into a file.

-No-emul-boot is enabled in non-simulated mode.

-Boot-load-size 4: set the number of loaded parts.

-Boot-info-table: the actual information in the startup image.

-Joliet-long uses the Directory and file name in joliet format. long file names are supported.

-R or-rock uses Rock RidgeExtensions.

-J or-joliet uses the Directory and file name in Joliet format.

-V or-verbose displays detailed information during execution.

-T or-translation-table is used to create a file name conversion table, which is applicable to systems that do not support Rock Ridge Extensions.

(3) differences between genisoimage, mkisofs, and xorrios commands

Speaking of genisoimage and mkisofs, there is a story in it.

At the earliest time, the Linux system used cdrtools to manage iso and CD. mkisofs was a tool in cdrtools. Later, cdrtools improved its authorization license and changed it from GPL to CDDL, the open-source community has released a set of GPL-based tools, including cdrkit and mkisofs, which are also removed by genisoimage. Now the mkisofs in the system is actually a soft connection of genisoimage:
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 images. It has a parameter-asmkisofs that can be compatible with mkiso commands.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.