Create a centos image 00:20:49
Tags: System
Centos
Leisure
Original Work in the workplace, which can be reproduced
Original source, author information, and this statement. Otherwise, legal liability will be held. Http://linux3zzy.blog.51cto.com/1244386/275290
Create a centos Image # 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 <$ File # 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 # 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 set the file system type Part swap -- fstype swap -- size 1024 Part/-- fstype ext3 -- size 20000 Reboot restart # 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.