打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
CentOS5.4定制笔记
第一部份:文字版
我有很多朋友从事网吧高管技术员。但是大型网吧老板都对ROS 海蜘蛛不太依赖,像QUICK LINUX又是收费的,心理作用呵呵。为此一个朋友向我提出能不能做一个精简一点的CentOS发行版。为此我建立了CENTOS这个发行版。以下是具体的制作过程和朋友们一起分享!希望能共同进步
声明:资料大多来源于网络,本人只是收集整理加实践,成功了写出的总结。
光盘结构介绍
*isolinux 目录存放光盘启动时的安装界面信息
*images 目录包括了必要的启动映像文件
*CentOS 目录存放安装软件包及信息
*.discinfo 文件是安装价质的识别信息
*lemp.tar.gz 文件存放系统初始化及其相关程序安装脚本.
环境说明:CentOS 5.4-i386 Vmware Workstation上完成制作工作.
准备工作:
VMware // 虚拟机,安装过程可以随意设置,错了可以再来
Secure // 串口、SSH连接工具(本实验用Putty即可)
下载一份DVD版CentOS5.4 Linux系统(即.ISO文件)
===================================================
1、在VM安装linux系统
安装anaconda repodata createrepo mkisofs ,关联太多采用yum安装//定制过程需要产生comps.xml文件以及生成iso
  1. yum -y install anaconda repodata createrepo mkisofs#安装制作发行版所需的基本软件包
  2. yum -y install anaconda-runtime createrepo yum-utils anacondaanaconda-help busybox-anaconda mkisofs
复制代码
2、生成packages.list 所安装的RPM包文件清单(由于install.log文件在root目录,所以该操作在root目录进行)
  1. cat install.log | grep Installing | sed 's/Installing //g' > /root/packages.list #生成后,需要仔细看该文件,一般会在某些文件开始部分如“1:”这样的字符,需要删除这些字符,否在后面执行copy动作会报错,注意引项为英文版Shell
  2. cat install.log | grep 安装 | sed 's/安装 //g' > /root/packages.list   #同上,中文版Shell
复制代码
3、建立定制Centos的源目录
  1. mkdir /disk     #定制时要复制RPM包的目录
  2. mkdir /mnt/cdrom   #加载光驱目录
  3. mount -o loop /dev/cdrom /mnt/cdrom     #将光盘内容加载到/mnt/cdrom中
  4. cd /mnt/cdrom/   #复制光盘内容到disk文件下,或者
  5. tar -cf - . | ( cd /disk ; tar -xvpf - )
  6. rm -rf /disk/CentOS/   #先删除所有RPM包
  7. mkdir /disk/CentOS/   #创建RPM包存放目录
复制代码
4、通过脚本复制系统安装的包;
  1. #!/bin/bash
  2. DEBUG=0
  3. DVD_CD=/disk/CentOS
  4. ALL_RPMS_DIR=/mnt/cdrom/CentOS/
  5. DVD_RPMS_DIR=$DVD_CD
  6. packages_list=/root/packages.list
  7. number_of_packages=`cat $packages_list | wc -l`
  8. i=1
  9. while [ $i -le $number_of_packages ] ; do
  10.         line=`head -n $i $packages_list | tail -n -1`
  11.         name=`echo $line | awk '{print $1}'`
  12.         version=`echo $line | awk '{print $3}' | cut  -f  2  -d  :`
  13.         if [ $DEBUG -eq "1" ] ; then
  14.                 echo $i: $line
  15.                 echo $name
  16.                 echo $version
  17.         fi

  18.         if [ $DEBUG -eq "1" ] ; then
  19.                 ls $ALL_RPMS_DIR/$name-$version*
  20.                 if [ $? -ne 0 ] ; then
  21.                         echo "cp $ALL_RPMS_DIR/$name$version* "
  22.                 fi
  23.         else
  24.                 echo "cp $ALL_RPMS_DIR/$name-$version* $DVD_RPMS_DIR/"
  25.                 cp $ALL_RPMS_DIR/$name$version* $DVD_RPMS_DIR/
  26.                 # in case the copy failed
  27.                 if [ $? -ne 0 ] ; then
  28.                         echo "cp $ALL_RPMS_DIR/$name$version* "
  29.                         cp $ALL_RPMS_DIR/$name* $DVD_RPMS_DIR/
  30.                 fi
  31.         fi
  32.         i=`expr $i + 1`
  33. done
复制代码
将以上内容保存为copyrpms.sh
  1. chmod 775 copyrpms.sh
  2. ./copyrpms.sh
复制代码
经过一系列的复制就完成了你要定制的RPM包(在/disk/CentOS/目录下);
5、定制安装控制文件ks.cfg
一般方便可以直接由root下面的anaconda-ks.cfg修改
  1. cp anaconda-ks.cfg /disk/ks.cfg
复制代码
样例内容如:
  1. # Kickstart file automatically generated by anaconda.
  2. install
  3. cdrom
  4. lang en_US.UTF-8
  5. keyboard us
  6. network --device eth0 --bootproto dhcp
  7. firewall --disabled
  8. authconfig --enableshadow --enablemd5
  9. selinux --disabled
  10. timezone --utc Asia/Shanghai
  11. bootloader --location=mbr --driveorder=sda
  12. # The following is the partition information you requested
  13. # Note that any partitions you deleted are not expressed
  14. # here so unless you clear all partitions first, this is
  15. # not guaranteed to work
  16. #clearpart --linux --drives=sda
  17. #part /boot --fstype ext3 --size=100 --ondisk=sda
  18. #part pv.6 --size=0 --grow --ondisk=sda
  19. #volgroup VolGroup00 --pesize=32768 pv.6
  20. #logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
  21. #logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=1000 --grow --maxsize=4032
  22. %packages
  23. @mysql
  24. @core
  25. @base
  26. @network-server
  27. @web-server
  28. %post
  29. echo "HOSTNAME=icesoul.local" >> /etc/sysconfig/network
  30. echo "# Do not remove the following line, or various programs" > /etc/hosts
  31. echo "# that require network functionality will fail." >> /etc/hosts
  32. echo "127.0.0.1         localhost" >> /etc/hosts
  33. echo "127.0.0.1         icesoul.local" >> /etc/hosts
  34. eject
  35. reboot
复制代码
6、修改isolinux.cfg文件 // 将/disk/isolinux/目录下的isolinux.cfg文件第一行default linux修改成default linux ks=cdrom:/ks.cfg
样例文件如:
  1. default linux ks=cdrom:/ks.cfg
  2. prompt 1
  3. timeout 60
  4. display boot.msg
  5. F1 boot.msg
  6. F2 options.msg
  7. F3 general.msg
  8. F4 param.msg
  9. F5 rescue.msg
  10. label linux
  11.   kernel vmlinuz
  12.   append initrd=initrd.img
  13. label text
  14.   kernel vmlinuz
  15.   append initrd=initrd.img text
  16. label ks
  17.   kernel vmlinuz
  18.   append ks initrd=initrd.img
  19. label local
  20.   localboot 1
  21. label memtest86
  22.   kernel memtest
  23.   append -
复制代码
7、生成comps.xml
  1. cd /disk/
  2. createrepo -g repodata/comps.xml /disk/
复制代码
到此以上定制任务已经完成。
8、制作IOS文件
  1. cd /disk/
  2. mkisofs -o MyCentOS.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T /disk/
复制代码
/disk/ 目录下产生的MyCentOS.iso 生成的ISO文件。
再用winscp把ISO文件拷出来拿到虚拟机实验,如果OK那就没问题了!
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
CentOS7下源码安装VPP
linux中rpm和yum
YUM原理和命令详解
配置Yum源repo文件及搭建本地Yum服务器
centos 安装libreOffice
使用CentOS DVD1 和DVD2做本地yum源
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服