Use the CD iso to automatically install and deploy the Linux operating system.

Source: Internet
Author: User

Use the CD iso to automatically install and deploy the Linux operating system.

I wrote an article on installing the operating system in batches using PXE, instead of having an environment in any place to install the operating system using PXE. If you need to install it on a CD, the installation is performed in interactive mode by default. In fact, you can use kickstart to automate installation and deployment. The implementation of the CD-Rom installation through ks. cfg is relatively simple, which is summarized below.

I. Implementation Principle

The disc is read by ks. cfg file to install the operating system, ks. place the cfg configuration file in the root directory of the CD, and then modify the isolinux/isolinux. cfg file, set kernel parameters, specify ks. the position of the cfg file. Because the original iso image file is read-only, it cannot be modified directly in the iso CD directory file. You need to copy it to a temporary directory and encapsulate it as an iso image file after modification.

Ii. Copy the temporary image directory

Mkdir/mnt/cdrommount-o loop CentOS-6.8-x86_64-minimal.iso/mnt/cdromcp-ar/mnt/cdrom // root/iso # No iso directory under the original root, copy it and rename it to iso

3. Generate the ks. cfg file

Generate ks. there are two cfg file methods. One is that you can use the graphic Tool system-config-kickstart to generate the specified ks. cfg file. Second, ks can be directly written if you are familiar with the kickstart syntax. cfg configuration file. The ks. cfg configuration used in this experiment is relatively simple. It is generated using a tool. The ks. cfg file is provided below.

#platform=x86, AMD64, or Intel EM64T#version=DEVEL# Firewall configurationfirewall --disabled# Install OS instead of upgradeinstall# Use CDROM installation mediacdrom# Root passwordrootpw --iscrypted $1$p6oEoqGo$UDHZdzw56Rl6Rt5oi1A0Q1# System authorization informationauth  --useshadow  --passalgo=sha512# Use graphical installgraphical# System keyboardkeyboard us# System languagelang en_US# SELinux configurationselinux --disabled# Do not configure the X Window Systemskipx# Installation logging levellogging --level=info# Reboot after installation#reboot# System timezonetimezone --isUtc Asia/Shanghai# Network informationnetwork  --bootproto=dhcp --device=eth0 --onboot=on# System bootloader configurationbootloader --location=mbr# Clear the Master Boot Recordzerombr# Partition clearing informationclearpart --all --initlabel # Disk partitioning informationpart /boot --asprimary --fstype="ext4" --ondisk=sda --size=200part swap --asprimary --fstype="swap" --ondisk=sda --size=4096part / --asprimary --fstype="ext4" --grow --ondisk=sda --size=1

Copy to the root directory of the CD image:

/bin/cp ks.cfg /root/iso/

4. Modify Kernel Parameters in the Startup Menu

Modify the menu item configuration file isolinux/isolinux. cfg:

Default vesamenu. c32 # prompt 1 timeout 1 # The Menu time setting is automatically selected for timeout. When it is set to 1, it is a flash. It is better to set it to 3 seconds.

Modify the kernel parameters and specify the ks. cfg location:

Label linux menu label ^ Install CentOS 6.8x64 System. # custom menu default kernel vmlinuz append initrd = initrd. imgKs = cdrom:/ks. cfg# Ks file location added: the root directory of the disc

5. encapsulate iso image files

Cd/root/iso/# enter the image creation directory

If the mkisofs command is not available, run the following command:

yum install mkisofs -y

Run the command to encapsulate the image:

mkisofs -o /root/CentOS6.8_x64.iso \    -V centos6 -b isolinux/isolinux.bin \    -c isolinux/boot.cat \    -no-emul-boot -boot-load-size 4 \    -boot-info-table -R -J -T -v .

Verify and write the md5 value (optional ):

implantisomd5 /root/CentOS6.8_x64.iso

The automatic installation through the CD has been completed. Next we can use the virtual machine to import an iso image for testing.

 

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.