How to customize your Linux system installation disk

Source: Internet
Author: User
How to customize your own Linux system installation disk 1. install the linux system on the VM 2. install the custom tool anacondarepodatacreaterepomkisofs. there are too many associations using the yum installation/customization process which requires comps. xml file and generate isowww.2cto.com [root @ localhost...
How to customize your own Linux system installation disk 1. install the linux system on the VM 2. install the custom tool anaconda repodata createrepo mkisofs. there are too many associations. use yum to install the disk. // comps is generated during the customization process. xml file and iso www.2cto.com [root @ localhost ~] # Yum-y install anaconda repodata createrepo mkisofs3, generate packages. list the RPM Package File list installed (because install. log files are in the root directory, so this operation is performed in the root directory.) [root @ localhost ~] # Cat install. log | grep Installing | sed's/Installing // g'>/root/packages. list // after the file is generated, you need to take a closer look at the file. Generally, the characters such as "1:" At the beginning of some files need to be deleted.
If these characters are not followed by the copy operation, an error is returned. 4. create a custom Centos source directory [root @ localhost ~]. # Mkdir/Disk // Copy the RPM package directory during customization; [root @ localhost ~] # Mkdir/mnt/cdrom // load the optical drive directory [root @ localhost ~] # Mount-o loop/dev/cdrom www.2cto.com/mnt/cdrom // load the content of the disc to/mnt/cdrom; [root @ localhost ~] # Cp-R/mnt/cdrom/./Disk remember to copy the ". discinfo" file on the disc. if the file is not copied
The following error is prompted: "The CentOS CD was not found in any of your CDROM drives.
Please insert the CentOS CD and press OK to retry. "[root @ localhost ~] # Rm-f/Disk/CentOS /*. rpm // delete all RPM packages first. 5. use scripts to copy the packages installed in the system (note that they must be in Unix format) [root @ localhost ~] # Vi copyrpms. sh #! /Bin/bashDEBUG = 0DVD_CD =/disk/CentOS ALL_RPMS_DIR =/mnt/cdrom/CentOS/DVD_RPMS_DIR = $ DVD_CDpackages_list =/root/packages. listnumber_of_packages = 'cat $ packages_list | wc-l 'I = 1 www.2cto.com 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 elseecho "cp $ ALL_RPMS_DIR/$ name-$ version * $ DVD_RPMS_DIR/" cp $ ALL_RPMS_DIR/$ name $ version * $ DVD_RPMS_DIR/# in case the copy failed if [$? -Ne 0]; then echo "cp $ ALL_RPMS_DIR/$ name $ version *" cp $ ALL_RPMS_DIR/$ name * $ DVD_RPMS_DIR/fi I = 'expr $ I + 1 'done www.2cto.com save the above content copyrpms. sh [root @ localhost ~] # Chmod 775 copyrpms. sh [root @ localhost ~] #. /Copyrpms. sh has completed the RPM package you want to customize (under the/Disk/CentOS/directory) after a series of copies. 6. customized installation control file ks. the cfgks file is mainly divided into three parts: 1. system installation and configuration 2. Custom installation preparation (% post -- nochroot) 3. Custom Installation (% post) system installation and configuration are generally written in ks. before the cfg file, define the system installation settings to % post-nochroot
For the end mark, the user-defined installation preparation section starts with "% post -- nochroot" and starts with "% post"
The custom installation starts with "% post. General convenience can be directly modified by the anaconda-ks.cfg under the root [root @ localhost ~] # Cp anaconda-ks.cfg/Disk/ks. the content of the cfg sample is as follows: # Kickstart file automatically generated by anaconda. install (specify to start a new installation system) cdrom (system installation method, there are many ways to install: Optical drive mode: if it is a optical drive, you can directly write it as cdrom here. Http installation: you can enter "url -- url http: // 192.168.12.142/centos/" in this access path,
It should be all files and directories of the decompressed Centos system. Hard disk installation method: "harddrive -- partition = sda1 -- dir =/iso, where sda1 is linux
The hard disk ID of the image file./iso is the Directory of the image file .) Www.2cto.com lang en_US.UTF-8 (system language settings) keyboard us (keyboard settings) xconfig -- startxonboot (set X desktop) # network -- device eth0 -- bootproto static -- ip 192.168.12.20.-- netmask 255.255.255.0
-- Gateway 192.168.12.1 (you can specify the system IP address as needed) rootpw -- iscrypted $1 $ sXpmDpgD $ IOEYOpdpXtxXgw7RmjtZS/(encrypted root password) firewall-disabled (firewall disabled) authconfig -- enableshadow -- enablemd5 (system authentication method, which enables md5 encryption by default) selinux-disabled (Selinux is disabled when the system is installed) timezone Asia/Shanghai (system time zone setting) bootloader -- location = mbr (boot option) # The following is the partition information you requested # Note that any partitions you deleted are not expressed # here so unless you clear all partitions first, this is # not guaranteed to work # clearpart -- all -- initlabel # part/-- fstype ext3 -- size = 3000 # part/boot -- fstype ext3 -- size = 100 # part/usr -- fstype ext3 -- size = 2000 # part/var -- fstype ext3 -- size = 2000 # part/cicro -- fstype ext3 -- size = 100 -- grow www.2cto.com # part swap -- size = 1024
Clearpart -- all -- initlabel) part/-- bytes-per-inode = 4096 -- fstype = "ext3" -- size = 15000 part/boot -- bytes-per-inode = 4096 -- fstype = "ext3" -- size = 100 part/var -- bytes-per-inode = 4096 -- fstype = "ext3" -- size = 5000 part/usr -- bytes-per-inode = 4096 -- fstype = "ext3 "-- size = 10000 part swap -- bytes-per-inode = 4096 -- fstype = "swap" -- size = 8096 part/cicro -- bytes-per-inode = 4096 -- fstype = "ext3" -- grow -- size = 1 reboot (this reboot must be written after the system partition) % pre,
Will be first mounted to the/mnt/source directory of the system, so the following operations are in this path) echo "Installing CWS" mkdir/tmp/custom_datacp/mnt/source/cws/cws_3.5.102_Linux_fixed.tar.gz/tmp/custom_data after the installation is complete, the CD is uninstalled, like copying files or RPM in the installation media
Such tasks cannot be executed. In this case, you need to use the "% post-nochroot" option. You can add the command to be run after the system is installed. This section must be at the end of the kickstart file and must
It starts with the % post command. Www.2cto.com % post -- nochroot
Command running outside the chroot environment) IXDBA. NET community forum cp/tmp/custom_data/users/mnt/sysimage/cicrocd/mnt/sysimage/cicrotar zxvf/mnt/sysimage/cicro/logs % post (after the system is installed, steps to run: the operations performed by nochroot in the root environment are exactly the same as those performed in a real linux system. Now the CD has
Automatically uninstalled by the system installer) echo "Configing Hostname" echo "HOSTNAME = webserver">/etc/sysconfig/networkecho "# Do not remove the following line, or various programs ">/etc/hostsecho" # that require network functionality will fail. ">/etc/hosts echo" 127.0.0.1localhost ">/etc/hosts www.2cto.com echo" 127.0.0.1webserver ">/etc/hosts echo" Config OS iso88591 "echo 'Lang =" en_US.iso88591 "'>/etc/sysconfig/i18ne Cho 'ororted = "en_US.iso885915: en_US: en "'>/etc/sysconfig/i18necho 'sysfont =" lat0-sun16 "'>/etc/sysconfig/i18necho 'sysfontacm =" iso15 "'>/etc/sysconfig/ i18n echo "Truning OS And Starting Services" chkconfig -- level 35 sendmail off/cicro/cws3/bin/startdb. shchown-R mysql: mysql/cicro/cws3/data/db/mysql/cicro/cws3/bin/startas. sh % packages (software package to be installed)/* % packages has two available options. -- Resolvedeps install the listed software packages and automatically resolve the software package dependency. If this option is not specified, but the software package dependency is
Yes. the automatic installation will be paused and prompt the user. For example:
% Packages -- resolvedeps www.2cto.com -- ignoredeps ignores unresolved dependencies and installs the listed software packages without dependencies. For example, % packages -- ignoredeps -- ignoremissing [1] ignores the missing software package or software package group, instead of suspending the installation to ask the user whether to stop or continue the installation. Example: % packages -- ignoremissing */@ development-libs @ editors @ gnome-software-development @ x-software-development @ gnome-desktop
@ Dialup @ core @ base @ legacy-software-development @ java-development @ base-x @ ruby @ kde-software-development @ development-tools @ graphical-internetmesa-libGLU-develdevice-mapper-multipathxorg-x11-server-Xnestxorg-x11-server-Xvfbimake www.2cto.com 7. modify isolinux. cfg file // use the isolinux file in the/Disk/isolinu/directory. change the first line of the cfg file from default linux to default linux
Ks = cdrom:/ks. cfg example File: default linux ks = cdrom:/ks. cfgprompt 1 timeout 60 display boot. msgF1 boot. msgF2 options. msgF3 general. msgF4 param. msgF5 rescue. msg label linux kernel vmlinuz append initrd = initrd. img label text www.2cto.com kernel vmlinuz append initrd = initrd. img text label ks kernel vmlinuz append ks initrd = initrd. imglabel local localboot 1 label memtest86 kernel memtest append-8, generate comps. xml [Root @ localhost ~] # Cd/Disk/[root @ localhost ~] # Createrepo-g repodata/comps. xml/Disk/the above custom task has been completed. 9. create an IOS file [root @ localhost ~] # Cd/Disk/[root @ localhost disk] # 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/Disk/www.2cto.com/Disk/directory MyCentOS. the iso file generated by ISO. Test the custom version to test the correctness of the iso. you can use the iso image of the VM to test the correctness of the custom system. The custom startup interface contains three files in isolinux related to the custom installation interface boot. msg defines how to display isolinux on the startup interface. cfg determines how to process user input and execute the corresponding installation process splash. lss is the background image of the startup Interface 1. boot. msgboot. msg content is roughly as follows: ^ L ^ Xsplash. lss www.2cto.com-To install or upgrade in graphical mode, press the ^ O0b ^ O07 key.-To install or upgrade in text mode, type: ^ O0blinux text ^ O07.-Use the function keys listed below for more information. ^ O0f [F1-Main] [F2-Options] [F3-General] [F4-Kernel] [F5-Rescue] ^ O07 boot. in msg, use ctrl + X to input ^ Xsplash. lss indicates the use of splash. the background image of the lss as the startup interface is followed by the prompt information ^ O0f and ^ O07 on the startup interface as highlighted. 2. splash. lsssplash. lss is the background image of the startup interface. this graphic file is special and can only be 14 colors (standard 16 colors remove black and white colors)
. Www.2cto.com
First, create a 16-color GIF file containing black, white, and white, named as splash.gif. you can also use the gimp tool in Linux.
Edit the GIF image and change "mode" to the index color in the "image" menu of gimp. The number is 14 because there are black and white images,
A total of 16 colors are added. Save the gif file after modification. Then, convert the file to the lss Format # giftopnm <splash.gif | ppmtolss16> splash. lss. This step can also be completed in two steps: # giftopnm Splash. pnm ppmtolss16 The splash. lssGiftopnm tool requires the netpbm toolkit. You can use yum install netpbm * to install netpbm-progs,
Netpbm-devel and netpbm packages.
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.