Custom Linux Image Batch deployment initial application

Source: Internet
Author: User

Main uses:

Automatically installs the operating system (Swap partition Interactive input), after the system is installed and automatically executes some custom scripts


1, mount the CD-ROM to/mnt, copy the contents to the new directory

Mount/dev/cdrom/mntmkdir/opt/isocp-rt/mnt/opt/iso

2. Modify the Isolinux.cfg file

Vim/opt/iso/isolinux/isolinux.cfgdefault VESAMENU.C32 changed to default Linux timeout 600 to timeout 30 3 seconds label Linux Menu label ^install or upgrade an existing system menu default kernel vmlinuz append initrd=initrd.img changed to: Label Linu X menu label ^install or upgrade an existing system menu default kernel vmlinuz append initrd=initrd.img ks=cdrom:/ks. Cfg

Where the ks.cfg is located under/opt/iso/, cdrom:/'s path is/opt/iso

3. Define KS.CFG File

#platform =x86, amd64, or intel em64t#version=develfirewall --disabled  # Disable firewall install           #新的安装cdrom               #安装介质为cdromtext               #文本安装keyboard  us           lang en_us. utf-8 selinux --disabled    #禁用selinuxskipxlogging  --level=inforootpw   --iscrypted $6$mq/o.xhph3l2wpjj$ 1iinnbxglcdm.zynvwocmhesilrc.oyu4in.1gtrresifa2wb4iavo8xma3yhcirhxsyym.zt1vzxzykcwam00authconfig -- enableshadow --passalgo=sha512  #经过加密的密码  --iscrypted represents a password that has been encrypted, such as rootpw  123456 Password directly to 123456reboottimezone  asia/shanghainetwork  --bootproto=static --device= eth0 --ip=10.0.1.1 --netmask=255.255.255.0 --onboot=onnetwork  --bootproto=static&Nbsp;--device=eth1 --onboot=onbootloader --location=mbrzerombrclearpart --all  part  /boot --fstype= "Ext4"  --size=200   #启动分区200M #part swap --fstype= "swap"  --size=4096  #Swap注释, read from configuration file (user interaction Input) part / --fstype= "Ext4"  --grow --size=1  #剩余的空间全部给/%include /tmp/mydata.txt          # Includes user-entered custom content%packages                     # The following are some of the packages that are installed by default @base@client-mgmt-tools@console-internet@core@debugging@directory-client@hardware-monitoring@java-platform@lar Ge-systems@network-file-system-client@performance@perl-runtime@server-platform@server-policy@x window  System@Desktop@Graphics Creation  Tools@chinese-supportpaxpython-dmidecodeoddjobsgpiodevice-mapper-persistent-datasamba-winbindcertmongerpam_ krb5krb5-workstationperl-dbd-sqlitefirefox%pre                    # Pre-installation defined scripts, switch to RRY6 terminal for interactive input swap partition #!/bin/bashexec < /dev/tty6 > /dev/tty6chvt  6clearecho -n  "Please input the swap size (M) -32g (32768) -64G (65536)-Or-Other:   "read sizeecho -e " part swap --fstype= "swap"  --size=${size} " >>  /tmp/mydata.txtexec < /dev/tty1 > /dev/tty1chvt 1#%post --nochroot        #从光盘拷贝文件到安装后的系统, the disc/directory is/mnt/source/, that is, under/opt/iso,/mnt/sysimage/for the completion of the system after the/ Catalogue cp /mnt/source/test.tar.gz /mnt/sysimage/opt/           #把光盘/opt/iso under the test.tar.gz  copy of the/OPT directory under the installation system #%post                    #安装系统后要执行的命令, here/directory is the real/directory after the system is loaded            sed -i  '/^id/s/3/5/g '  /etc/inittab       # Change the system boot level to 5cd /opttar -zxf test.tar.gz -c /opt             #把/opt test.tar.gz decompression to the/optcd /opt/test/123  #进入某目录, which is equivalent to the real operating system command bash  /opt/test/123/test.sh  #执行某目录下的脚本%end


More ks.cfg parameter Reference https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/ S1-kickstart2-options.html

4. Reset Repodata

Rm-f repodata/*.gz repodata/*.*.bz2 repodata/*.repomd.xml declare-x discinfo= ' head-1. Discinfo ' Createrepo-u media://$ Discinfo-g Repodata/2a7e0c1da38a40e2961c0cec6acca8b8446d974b1fc055216ebde88bb4a19eb9-c6-x86_64-comps.xml.

5. Re-encapsulation of ISO

Cd/opt/isomkisofs-r-l-r-t-no-emul-boot-j-C isolinux/boot.cat-b isolinux/isolinux.bin-o/root/test.iso-boot-load -size 4-boot-info-table-no-bak.

Re-encapsulate the image to/root/test.iso,test.iso is the created image, the above parameters do not change, unless it is clear what to do

There are several main points to note:

1, when the CD-ROM installation, the temporary directory of CD-ROM is/mnt/source/(when the USB is burned to CD-ROMs, this directory is/mnt/stage2)

2, the installation process system directory for/mnt/sysimage/

If the custom ISO is too large (more than 4G), you will not be able to burn to a normal disc, you can burn to a USB flash drive, make a CD-ROM to use

U disk requires mass production, can refer to http://jingyan.baidu.com/article/20095761bd435ecb0721b4bb.html

The following error occurs when you use a USB flash drive to emulate a CD-ROM (ISO booting in VMware no problem)


Error One:

No driver findunabled to find any devices of the typeneeded for this installation type. Woulud to manually select Yourdevice or use a driver Disk?

Workaround:

After booting from the CD, press the ESC key quickly and enter "Linux all-generic-ide irqpoll pci=nommconf"


Error Two:

Unable to read the group information from repositories. Thisis a problem with the generation of your install tree

Workaround:

Reset the Repodata, and then regenerate the mirror

Rm-f repodata/*.gz repodata/*.*.bz2 repodata/*.repomd.xml declare-x discinfo= ' head-1. Discinfo ' Createrepo-u media://$ Discinfo-g Repodata/2a7e0c1da38a40e2961c0cec6acca8b8446d974b1fc055216ebde88bb4a19eb9-c6-x86_64-comps.xml.


This article from "Life is endless, struggle not only!" "Blog, be sure to keep this provenance http://linuxnote.blog.51cto.com/9876511/1834293

Custom Linux Image Batch deployment initial application

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.