build custom centos7
必读,在以下内容之前。
pre:
0. install log
推荐使用pungi
这哥们写了不少不错的文章。 还有python的设计模式。
pungi --nohash --nosource --nodebugingo -G -C -B -I --name=demo --version=1.0 --destdit=./out -c package.ks
package.ks 是需要安装的包列表。
2. cloud的部署安装
There is a script to create custom iso
3. make the ISO
https://serverfault.com/questions/517908/how-to-create-a-custom-iso-image-in-centos
-
Create a directory to mount your source.
mkdir /tmp/bootiso
-
Loop mount the source ISO you are modifying. (Download from Red Hat / CentOS.)
mount -o loop /path/to/some.iso /tmp/bootiso
-
Create a working directory for your customized media.
mkdir /tmp/bootisoks
-
Copy the source media to the working directory.
cp -r /tmp/bootiso/* /tmp/bootisoks/
-
Unmount the source ISO and remove the directory.
umount /tmp/bootiso && rmdir /tmp/bootiso
-
Change permissions on the working directory.
chmod -R u+w /tmp/bootisoks
-
Copy your Kickstart script which has been modified for the packages and
%post
to the working directory.cp /path/to/someks.cfg /tmp/bootisoks/isolinux/ks.cfg
-
Copy any additional RPMs to the directory structure and update the metadata.
cp /path/to/*.rpm /tmp/bootisoks/Packages/. cd /tmp/bootisoks/Packages && createrepo -dpo .. .
-
Add kickstart to boot options.
sed -i 's/append\ initrd\=initrd.img/append initrd=initrd.img\ ks\=cdrom:\/ks.cfg/' /tmp/bootisoks/isolinux/isolinux.cfg
-
Create the new ISO file.
cd /tmp/bootisoks && \ mkisofs -o /tmp/boot.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -V "CentOS 7 x86_64" -R -J -v -T isolinux/. .
-
(Optional) Use
isohybrid
if you want todd
the ISO file to a bootable USB key.isohybrid /tmp/boot.iso
-
Add an MD5 checksum (to allow testing of media).
implantisomd5 /tmp/boot.iso
- others
4. other introduce.
make-a-custom-centos-7-or-rhel-7-cd-with-kicktart-file
Make a custom CentOS-7 or RHEL-7 CD With kicktart File
红帽(Red Hat)从Enterprise Server 6.2 开始,启动镜像文件initrd.img 开始改用xz 工具进行压缩,这与以往版本是有区别的
To decompress an image, use the xz -d
command. For example
How to unpack and repack an initial ramdisk (initrd/initramfs) image?
三、补充tar.lzma
由于LZMA具有优秀的压缩率及占用资源少的特点,越来越多的工具采用lzma进行打包,后缀名为:tar.lzma。
对于Fedora 11 及以后的版本,可以使用下面的命令操作:
压缩
# tar cfv backup.tar.lzma a/dir --lzma
解压:
# tar xfv backup.tar.lzma --lzma
如果是CentOS 5.3 等老版本,需要安装独立的lzma 工具或用xz 进行:
压缩:
# tar cv a/dir | lzma -c -z > backup.tar.lzma
解压(两个方式都可以):
# cat backup.tar.lzma | lzma -d | tar xv
# xz -dc backup.tar.lzma | tar xvf -
ref:
CentOS7定制封装发行版-基于CentOS minimal
cat buildiso.sh
#!/bin/bash cd repodata mv *-minimal*-comps.xml comps.xml ls .|grep -v "comps.xml"|xargs -i rm -f {} cd ../ createrepo -g repodata/comps.xml ./ declare -x discinfo=`head -1 .discinfo` mkisofs -R -J -T -r -l -d -joliet-long -allow-multidot -allow-leading-dots -no-bak -o/tmp/centos7.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table .
How to create a Fedora install ISO for testing