Customize your own eversecos
A: Requirements: Use the CentOS-5.5-i386-bin-DVD.iso to customize their own release.
Performance requirements: the installation process requires you to choose which components of the company and which RPM packages to install. During the installation process, you can configure the configuration files of the company's software development through a specific interface.
Interface requirements: Text images must be the company's content or logo.
Ii. Completed work:
Performance. After ks. cfg is configured, you can only install components and RPM packages in the text mode.
The image of the installed centos does not know how to replace it.
Iii. Production method:
1. install some software before creating the release. The installation method is as follows:
# Yum-y install Anaconda-runtime createrepo Yum-utils Anaconda-help busybox-anaconda mkisofs
2. to create a centos-based Linux, you must install centos again on the VM. During installation, select the necessary packages, such as base, develop-tools, text-Internet, etc. It is best not to select other things that cannot be used. The system created in this way can ensure the volume.
3. after completing step 2, go to the system installed in step 2 and create some directories under the root directory to store the files required for the Linux release, for example, when I name my system eversecos, I create an eversecos directory under the/directory to store the files required for Linux release.
# Mkdir/eversecos
4. we need to mount the centos DVD to Linux. We can mount the optical drive or the ISO file. before mounting, we first create a directory under the/mnt/directory, used for mounting.
# Mkdir/mnt/CDROM
// DVD
# Mount-T iso9660-o loop/dev/CDROM/mnt/CDROM // mount the optical drive
// ISO file
# Mount-T iso9660-o loop/mnt/HGFS/centos_data1/CentOS-5.5-i386-bin-DVD.iso/mnt/CDROM
5. After mounting, use the tar command to copy all the files in the drive to the/eversecos directory:
# Cd/mnt/CDROM
# Tar-CF-. | (CD/eversecos; tar-xvpf -)
6. Go to/eversecos/centos to delete all files (RPM package)
# Cd/eversecos/centos
# Rm-f *
7. Go to/eversecos and delete some files (folders ). After the deletion, LS-Al only leaves the following content:
# Rm xxx
# Ls-Al
Drwxr-XR-x 2 ossec 155648 09-03 centos
-RW-r -- 1 Root 112 03-21 23:05. discinfo
Drwxr-XR-x 4 Root 4096 03-21 23:04 Images
Drwxr-XR-x 2 root Root 4096 09-03 :51 isolinux
Drwxr-XR-x 2 root Root 4096 09-03 19: 47 repodata
-RW-r -- 1 Root 1318 2009-09-04 Trans. TBL
-RW-r -- 1 Root 413 03-21 23:04. treeinfo
8. after the centos system is installed, the installation information of all RPM packages is recorded in the/root/directory install. in the log file, we can copy the required RPM package to the/eversecos/centos/directory through script operations on this file and/mnt/CDROM file.
# Cd/root/
// Generate packages. List to copy the RPM package later.
# Cat install. log | grep installing | SED's/installing // G' | SED's/^ [0-9] \ +: // G'> packages. List
Create an automatic extraction RPM script:
# Vi cprpms. Sh
#! /Bin/bash
DEBUG = 0
Lt_cd =/mnt/CDROM
# Directory for storing attached discs
All_rpms_dir =/mnt/CDROM/centos
# Directory for storing RPM packages
Lt_rpms_dir =/eversecos/centos
Packages_list =/root/packages. List
Number_of_packages = 'cat $ packages_list | WC-l'
I = 1
While [$ I-Le $ number_of_packages]; do
Line = 'head-N $ I $ packages_list | tail-n-1'
Name = 'echo $ Line | awk' {print $1 }''
Version = 'echo $ Line | awk' {print $3} '| cut-F 2-D :'
If [$ debug-EQ "1"]; then
Echo $ I: $ line
Echo $ name
Echo $ version
Fi
If [$ debug-EQ "1"]; then
Ls $ all_rpms_dir/$ name-$ version *
If [$? -Ne 0]; then
Echo "CP $ all_rpms_dir/$ name-$ version *"
Fi
Else
Echo "CP $ all_rpms_dir/$ name-$ version * $ lt_rpms_dir /"
CP $ all_rpms_dir/$ name-$ version * $ lt_rpms_dir/
# In case the copy failed
If [$? -Ne 0]; then
Echo "CP $ all_rpms_dir/$ name-$ version *"
CP $ all_rpms_dir/$ name * $ lt_rpms_dir/
Fi
Fi
I = 'expr $ I + 1'
Done
Run the above script to copy the RPM necessary for the custom eversecOS-0-1 to the/eversecos/centos directory
# Chmod U + x cprpms. Sh
#./Cprpms. Sh
9. At this time, under/eversecos/centos, all the. RPM packages required for the last centos installation were available.
If you want to add your own. RPM package, you need to manually add it to this folder. For example: if the last installation, there is no choice to install FTP, and your own customized eversecOS-0-1.iso needs to install vsftpd, then put the vsftpd-2.0.5-16.el5_4.1.i386.rpm in/eversecos/centos
10. After preparing the RPM package, return to the/eversecos directory and run the createrepo program to generate the comps. xml file under repodata.
# Cd/eversecos
# Createrepo-G repodata/comps. xml.
11. After comps. XML is generated, you will start to create the Kickstart script, you can complete the customization of the Kickstart script through the anaconda-ks.cfg:
# Cd ~
# Cp anaconda-ks.cfg/eversecos/isolinux/KS. cfg
Use VI to modify ks. cfg as follows:
# Vi/eversecos/isolinux/KS. cfg
# Kickstart file automatically generated by Anaconda.
Install
Text
CDROM
Lang en_US.UTF-8
Keyboard us
Skipx
Network -- device eth0 -- bootproto DHCP -- hostname eversecos
# Here the password is encrypted, must be consistent with the anaconda-ks.cfg
Rootpw -- iscrypted $1 $ G. am7xrn $ xviiyctu8r51cm91dgqog/
Authconfig -- enableshadow -- enablemd5
SELinux -- disabled
Timezone -- UTC Asia/Shanghai
Bootloader -- location = MBR
Zerombr Yes
Mouse generic3ps/2
Clearpart -- all -- initlabel
Reboot
% Packages
@ Base
@ Core
@ DNS-Server
@ Development-libs
@ Development-Tools
@ Dialup
@ Editors
@ Gnome-Desktop
@ Games
@ Graphical-Internet
@ Graphics
@ Office
@ Printing
@ Sound-and-video
@ Text-Internet
@ Base-x
Keyutils
Trousers
Fipscheck
Device-mapper-multipath
Imake
Java-1.6.0-openjdk
Libsane-hpaio
Xorg-x11-server-Xnest
Xorg-x11-server-Xvfb
Vsftpd
You can install the tar.gz program after the postextension.
% Post
Mkdir-P/Yin/HAI/long # Statement of successful experiment
Mount/dev/CDROM/mnt # Experiment failure statement
CP/mnt/test.jpg/Yin/HAI/long/test.jpg # Statement of experiment failure
12. after the Kickstart script is written, you need to modify the default installation method of Linux. Here, modify/eversecos/isolinux. cfg file to achieve our goal, it is worth noting that isolinux. the cfg file is read-only. To modify the file, you must grant the write permission to it:
# Chmod + w/eversecos/isolinux. cfg
# Cd/eversecos/isolinux/
# Vi isolinux. cfg
Default KS
Prompt 1
Timeout 600
Display boot. msg
F1 boot. msg
F2 options. msg
F3 General. msg
F4 Param. msg
F5 rescue. msg
Label Linux
Kernel vmlinuz
Append initrd = initrd. img
Label text
Kernel vmlinuz
Append initrd = initrd. IMG text
Label KS
Kernel vmlinuz
Append Ks = CDROM:/isolinux/KS. cfg initrd = initrd. img
Label local
Localboot 1
Label memtest86
Kernel memtest
Append-
13. Modify the screen:
The installation of the startup screen uses a strange format, which limits the use of 16 colors, except that the foreground and background colors can only have 14 colors. We need ppmtolss16 giftopnm and other programs. The system is generally installed by default.
Generally, gimp is used to generate an index-based GIF image with a color limit of 14. Then, convert it using the following method:
# Yum-y install syslinux
High-quality GIF images:
Bytes
Still use giftopnm <splash.gif | ppmtolss16> splash. lss conversion.
Then replace the New splash. lss file with the same name in/eversecos/isolinux.
In addition, modify the isolinux/boot. MSG file and make some personalized prompts.
Modify the image of the custom installation process of images/stage2.img.
Stage2.img uses squashfs to directly mount the file system.
We create two directories and mount one user to modify the file.
Mkdir/tmp/stage {1 .. 2}
Mount-o loop-T squashfs stage2.img/tmp/stage1
Copy an object to stage2
CD/tmp/stage1
Tar xzf-. | (CD/tmp/stage1; tar-xvpf -)
Note:
This file/tmp/stage1/. buildstamp must be copied to the related directory of stage2; otherwise
"No centos CD was found which matches your boot" appears during installation
Media"
CD/tmp/stage2/usr/share/Anaconda/pixmaps
Change the image in this directory.
Generate a new stage2.img
CD/tmp/stage2/
Mksquashfs.../stage2.img-all-root-no-Fragments
14. Remove the centos text during installation and replace it with eversecos:
There are two installation discs. buildstamp file, one in stage2.img and the other in initrd. in IMG, initrd is read when the installation disc is running. the one in IMG. buildstamp file, so you only need. you can modify the imgfile.
Decompress the initr. dimg file:
In kernel 2.6, initrd. IMG adopts cpio compression. It is no longer in the ext2 format used by kernel 2.4 and cannot be mounted using Mount-o loop. You need to use gunzip to decompress and then use
Use cpio to unpackage img
# Cd/eversecos/isolinux/
# Cp initrd. img/tmp/initrd.img.gz
# Cd/tmp
# Gunzip initrd.img.gz
# Mkdir initrd
# Mv initrd. IMG initrd
# Cd initrd
# Cpio-ivmd <initrd. img
Modify the. buildstamp file and change centos to eversecos.
Make the initrd. imgfile:
# Assume that the current directory is in the root directory of the prepared initrd file system.
# Find. | cpio-c-o> ../initrd. img
# Gzip ../initrd. img
# Mv initrd.img.gz initrd. img
# Cp initrd. img/eversecos/isolinux/
Copy initrd. IMG to/eversecos/isolinux/
15. How do I replace grub after installation?
(1) Prepare a 640x480 16-color grub.gif image in JPG format.
(2) convert grub.gif-colors 14-geometry 640x480! Splash. XPM & gzip-9 splash. XPM
(3) directly replace the generated splash.xpm.gz file with the/boot/grup/splash.xpm.gz file. (write the shell script after the KS. cfg file % post Statement on the installation disc .)
16. How to remove "centos Release 5 (final)" during startup )"
Write the script in the KS. cfg file on the installation disc and replace/etc/RedHat-release/etc/issue/boot/GRUB/grub. conf.
If [-F/etc/issue]; then sed-I's/centos release 5.5 (final)/eversecos 0.1/'/etc/issue; FI>/dev/null 2> & 1
If [-F/boot/GRUB/grub. conf]; then sed-I's/centos/eversecos 0.1/'/boot/GRUB/grub. conf; FI>/dev/null 2> & 1
Echo "eversecos 0.1">/etc/RedHat-release
17. after completing the above work, you can use mkisofs to publish the ISO file. You cannot directly copy the/eversecos directory to a software such as ultraiso for Windows, because it cannot be guided
# Cd/eversecos
# Mkisofs-r-J-t-r-l-D-allow-multidot-allow-leading-dots-no-Bak-o/mnt/HGFS/centos_data1/eversecOS-0-1.iso-B isolinux/isolinux. bin-C isolinux/boot. cat-no-emul-boot-load-size 4-boot-Info-table
.
End:
After the ISO is created, you can download the ISO to Windows and use VMWare for installation. If the installation is successful, the ISO is created successfully.
//////////////////////////////////////// //////////////////////////////////////// /////
Example:
% Post -- nochroot
# Mount CDROM
Mkdir-P/mnt/CDROM
Mount-r-t iso9660/tmp/CDROM/mnt/CDROM
# Copy our file
Unalias CP
CP-F/mnt/CDROM/splash.xpm.gz/mnt/sysimage/>/dev/null
CP-F/mnt/CDROM/default.jpg/mnt/sysimage/>/dev/null
# Cp-F/mnt/CDROM/default.jpg/>/dev/null
CP/mnt/CDROM/splash.xpm.gz/>/dev/null
Umount/mnt/CDROM
% Post
If [-F/etc/issue]; then sed-I's/centos release 5.5 (final)/eversecos 0.1/'/etc/issue; FI>/dev/null 2> & 1
If [-F/boot/GRUB/grub. conf]; then sed-I's/centos/eversecos 0.1/'/boot/GRUB/grub. conf; FI>/dev/null 2> & 1
Echo "eversecos 0.1">/etc/RedHat-release
Unalias CP>/dev/null
CP-F/default.jpg/usr/share/backgrounds/images/>/dev/null
# Unalias CP>/dev/null
Rm-F/boot/GRUB/splash.xpm.gz>/dev/null
CP-F/splash.xpm.gz/boot/GRUB/>/dev/null
Startx>/dev/null
// Modifications to centos include:/var/log/boot. Log
Http://bbs.linuxtone.org/thread-2448-1-1.html