Create a centos image file that can be automatically installed [Copy link]

Source: Internet
Author: User
Create a centos image file that can be automatically installed [Copy link]

00
  Direct elevator

1Building [add to Favorites (0)] [report]

Posted on 23:45:01| View only the author | view in reverse order
To create an automatically installed centos image file, follow these steps:
# Mkdir-pv iso/centos first create the centos directory
# Touch packages.txt create this file to store the package name
# Touch cperr.txt create this file to view errors
# Awk \ '/^ installing/{print $2} \ 'Install. log | sed \'s/^ [0-9] *: // G \'> packages.txt
Generate the packages.txt file to extract the name of the software package to be installed.
# Mount/dev/CDROM/Media/CDROM
# Vim myiso. Sh create a shell script
The script content is as follows:
#! /Bin
# Myiso. Sh
File = \ '/root/packages.txt \'
Dest_dir = \ '/root/ISO/centos \'
Src_dir = \ '/Media/CDROM/centos \'

While read line
Do
CP $ src_dir/$ line. RPM $ dest_dir | echo \ "$ line didn \'t CP... \"> cperr.txt
Done
# Bash-N myiso. Sh check error
# Bash myiso. Sh execute myiso. Sh
# Cd/Media/CDROM
CDROM] # cp-R. discinfo. treeinfo images/isolinux repodata/RPM-GPG-KEY-CentOS-5 eula gpl/root/ISO/
Some of these files can be non-CP, such as images files, and some files must be CP, such as isolinux (This file contains the system kernel information and initrd. IMG and isolinux. cfg and other important files), repodata
# Cd home directory
# Du-Sh./ISO/view./ISO/size
# Cd ISO/isolinux/
# Cp anaconda-ks.cfg ISO/KS. cfg
# Cd/ISO/isolinux
Edit the isolinux. cfg file

Add Ks = CDROM:/KS. cfg to the first line.
# Cd back to the home directory
# Cp anaconda-ks.cfg ISO/KS. cfg
# Vim ks. cfg edit the KS. cfg file
Text indicates installation on the Character Interface
CDROM indicates that the system is installed on a CD
Keyboard us select keyboard
Lang en_US.UFT-8 selection Language
Network -- device eth0 -- bootproto DHCP set Nic Configuration
Rootpw RedHat: Set the password to RedHat.
Authconfig -- useshadow -- enablemd5
Firewall -- disable Firewall
SELinux -- disable SELinux
Timezone -- UTC Asia/Shanghai select the time zone
Bootloader -- location = MBR -- drivercorder = SDA start the system
Clearpart -- all -- drivers = SDA
Part/boot -- fstype ext3 -- size 100
Part swap -- fstype swap -- size 1024
Part/-- fstype ext3 -- size 20000
Reboot restart
After editing, save and exit
# Cd ISO/
ISO] # createrepo-G repodata/comps. xml ../ISO/check dependency
If you do not have createrepo, install its software package first.
# Cd
# Mkisofs-O mycentos. iso-B isolinux/isolinux. bin-C isolinux/boot. cat-no-emul-boot-load-size 4-boot-Info-table-r-J-v-t iso/
Use the preceding command to create an ISO Image
Import the image to the real machine, create another virtual machine, and install centos with the created ISO image.

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.