Linux系统封装成iso文件

若如初见. 提交于 2019-12-02 22:46:04
#安装所需软件包
yum -y install createrepo mkisofs anaconda-runtime  

根据root下的install.log文件,得到安装的软件包
awk '/Installing/{print $2}' install.log |sed 's/^[0-9]*://g' >/root/packages.list

[root@localhost www]# mkdir centOS6.32bit
[root@localhost html]# rsync -a --exclude=Packages centOS6 centOS6.32bit/
[root@localhost html]# pwd
/var/www/html
[root@localhost html]# mkdir centOS6.32bit/Packages


复制软件包
for fileRpm in `cat packages.list`; do cp -r /var/www/html/centOS6/Packages/$fileRpm* /var/www/html/centOS6.32bit/centOS6/Packages ; done

按照执行就可以
[root@localhost centOS6]# cd /var/www/html/centOS6.32bit/centOS6
[root@localhost centOS6]# createrepo -g repodata/*-comps.xml /var/www/html/centOS6.32bit/centOS6
491/491 - Packages/abrt-addon-ccpp-2.0.8-6.el6.centos.i686.rpm                  
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@localhost centOS6]# declare -x discinfo=`head -1 .discinfo`
[root@localhost centOS6]# createrepo -u "media://$discinfo" -g repodata/*-comps.xml /var/www/html/centOS6.32bit/centOS6/
488/488 - Packages/glibc-2.12-1.80.el6.i686.rpm                                 
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@localhost centOS6]#


[root@localhost centOS6]# createrepo -g repodata/*-comps.xml /var/www/html/centOS6.32bit/centOS6/
488/488 - Packages/glibc-2.12-1.80.el6.i686.rpm                                 
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@localhost centOS6]# echo $?       #测试上条命令是否运行成功

按照执行就可以
mkisofs -R -J -T -r -l -d -joliet-long -allow-multidot  -allow-leading-dots -no-bak -o/home/CentOS-6.3-i386-bin-DVD1.iso  -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot  -boot-load-size 4 -boot-info-table /var/www/html/centOS6.32bit/centOS6

-o 输出iso文件位置

[root@localhost home]# /usr/bin/implantisomd5 CentOS-6.3-i386-bin-DVD1.iso
Inserting md5sum into iso image...
md5 = 219c7e289d01cdb84cf99de8b3e04503
Inserting fragment md5sums into iso image...
fragmd5 = a9265bee4498b5e93a2e84a58235458cad3651caa37f41da397155e6abe1
frags = 20
Setting supported flag to 0
[root@localhost home]#

二、 linux制作iso镜像方法总结

把/dev/cdrom目录制作为镜像,名字为/root/centos6.3.iso
方法1:dd if=/dev/cdrom of=/root/centos6.3.iso
方法2:#cat /dev/cdrom >;/root/centos6.3.iso
方法3:mkisofs -r -o centos6.3.iso /dev/cdrom
方法4:cp -r /home/user name.iso
生成iso镜像以后,就可以用linux下的DVD进行刻录,刻录为DVD光盘了。

前提是已安装好的linux系统都是rpm包安装,这样才能根据/root/install.log文件定制出iso文件。
 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!