一、之前有写过一篇管理定制CentOS5.6的文章,最近公司外网生产环境准备用CentOS6系列的,手动安装是在是太麻烦,所以就又研究了一些6系列的封装,其实和5系列的差不多,就是有几个文件不一样,还有就是ks.cfg这个文件我又更新了新内容。

二、开始定制
1、安装需要的用到的软件包
[root@localhost ~]# yum -y install createrepo mkisofs
2、生成安装系统所需要的rpm文件列表
[root@localhost ~]# awk '/Installing/{print $2}' install.log |sed 's/^[0-9]*://g' >/root/packages.list

3、创建工作目录
[root@localhost ~]# mkdir -p /mnt/cdrom
[root@localhost ~]# mkdir -p /data/OS
[root@localhost ~]# mount /dev/cdrom /mnt/cdrom
4、复制文件
[root@localhost ~]# rsync -a --exclude=Packages /mnt/cdrom/* /data/OS/
[root@localhost ~]# cp /mnt/cdrom/.discinfo /data/OS/
5、复制精简后的rpm包
a、撰写脚本

cat cp.sh
#!/bin/bash
DVD='/mnt/Packages'    #DVD镜像存放包路径
PACKDIR='/root/package.txt'     #记录的是现在系统里安装的所有包名
NEW_DVD='/root/iso/Packages/'   # 新镜像需要包的存放路径
while read LINE;
     do cp ${DVD}/${LINE}*.rpm  /${NEW_DVD} || echo "$LINE don't cp......."; 
     done < package.txt

[root@localhost ~]# chmod +x /data/cprmps.sh 
[root@localhost ~]# sh /data/cprmps.sh

6、撰写ks.cfg文件
[root@localhost ~]# vi /data/OS/isolinux/ks.cfg

# Kickstart file automatically generated by anaconda.

#version=RHEL6
install
cdrom
lang en_US.UTF-8
keyboard us
network --device eth0 --onboot no --bootproto static --ip 192.168.1.222 --netmask 255.255.255.0 --gateway 192.168.1.1 --nameserver 8.8.8.8 --hostname wy.cn
rootpw  --iscrypted $6$qonSDczLascaQ556$dty34p2Ff9VVM70Zek0Utht5pK1n4dvx0mAEEV7Y6aPbl7590mrVb9sN8v6Q3JJdx99uzrU/5CBXfUKVE1cFr1
firewall --disabled
authconfig --enableshadow --passalgo=sha512 --enablefingerprint
selinux --disabled
timezone Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# 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

part /boot --fstype=ext4 --size=500
part pv.XHGICy-t31o-N3CL-0QxU-G2l4-gaKE-uleXGL --grow --size=1
volgroup vg_wy --pesize=4096 pv.XHGICy-t31o-N3CL-0QxU-G2l4-gaKE-uleXGL
logvol / --fstype=ext4 --name=lv_root --vgname=vg_wy --grow --size=1024 --maxsize=51200
logvol swap --name=lv_swap --vgname=vg_wy --grow --size=2032 --maxsize=4064
repo --name="centos"  --baseurl=file:///mnt/source --cost=100
reboot

%packages
@additional-devel
@base
@core
@development
@perl-runtime
@server-policy
libXinerama-devel
xorg-x11-proto-devel
startup-notification-devel
libgnomeui-devel
libbonobo-devel
libXau-devel
libgcrypt-devel
popt-devel
libXrandr-devel
libxslt-devel
libglade2-devel
gnutls-devel
mtools
sgpio
jpackage-utils
perl-DBD-SQLite
%end

%post
# file descriptors
ulimit -HSn 655350
echo "* soft nofile 655350" >> /etc/security/limits.conf
echo "* hard nofile 655350" >> /etc/security/limits.conf

#set ntp
ntpdate 1.cn.pool.ntp.org && /sbin/hwclock --systohc
/bin/cat > /etc/cron.daily/ntpdate << _ntpdate
#!/bin/bash
/sbin/ntpdate 1.cn.pool.ntp.org && /sbin/hwclock --systohc
_ntpdate

#set /etc/sysctl.conf
/bin/cat > /etc/sysctl.conf << _sysctl
fs.file-max = 1000000
kernel.core_uses_pid = 1
kernel.msgmax = 65536
kernel.msgmnb = 65536
kernel.shmall = 4294967296
kernel.shmmax = 68719476736
kernel.sysrq = 0
net.core.netdev_max_backlog = 262144
net.core.rmem_default = 2097152
net.core.rmem_max = 16777216
net.core.somaxconn = 262144
net.core.wmem_default = 2097152
net.core.wmem_max = 16777216
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.ip_conntrack_max = 819200
net.ipv4.ip_forward = 0
net.ipv4.ip_local_port_range = 1024    65000
net.ipv4.neigh.default.gc_thresh1 = 10240
net.ipv4.neigh.default.gc_thresh2 = 40960
net.ipv4.neigh.default.gc_thresh3 = 81920
net.ipv4.netfilter.ip_conntrack_max = 819200
net.ipv4.netfilter.ip_conntrack_tcp_timeout_close_wait = 60
net.ipv4.netfilter.ip_conntrack_tcp_timeout_fin_wait = 120
net.ipv4.netfilter.ip_conntrack_tcp_timeout_time_wait = 120
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_intvl = 15
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_max_tw_buckets = 51200
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_orphan_retries = 3
net.ipv4.tcp_reordering = 5
net.ipv4.tcp_retrans_collapse = 0
net.ipv4.tcp_retries2 = 5
net.ipv4.tcp_rmem = 4096        87380   4194304
net.ipv4.tcp_sack = 1
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_wmem = 4096        16384   4194304
net.ipv6.conf.all.disable_ipv6 = 1
_sysctl
source /etc/profile
sysctl -e -p
/etc/init.d/avahi-daemon stop
/etc/init.d/yum-updatesd stop
chkconfig avahi-daemon off
chkconfig yum-updatesd off

echo "WyLinux release 6.0 (Based on CentOS 6.0)" > /etc/centos-release
sed -i 's/CentOS Linux release 6.0 (Final)/WyLinux release 6.0 (Based on CentOS 6.0)/g' /etc/issue
sed -i 's/CentOS Linux release 6.0 (Final)/WyLinux release 6.0 (Based on CentOS 6.0)/g' /etc/issue.net
sed -i 's/localhost.localdomain/WyLinux/g' /etc/sysconfig/network
sed -i 's/CentOS/WyLinux/g' /etc/rc.d/rc.sysinit
sed -i 's/rhgb/WyLinux/g' /boot/grub/grub.conf

mkdir -p /media/cdrom
mount -o loop /dev/cdrom /media/cdrom
cp -rf /media/cdrom/web.tar.gz /usr/local/
cd /usr/local/
chmod 755 -R *.tar.gz
tar xvzf web.tar.gz
rm -rf web.tar.gz
/usr/local/apache/bin/apachectl start

7、生成comps.xml文件

[root@localhost ~]# cd /data/OS
[root@localhost ~]# createrepo -g repodata/*-comps.xml /data/OS/

8、让系统启动读开始,ks.cfg的内容
修改lable linux
[root@localhost ~]# vi /data/OS/isolinux/isolinux.cfg
label linux
  menu label ^Install or upgrade an existing system
  menu default
  kernel vmlinuz
  append ks=cdrom:/isolinux/ks.cfg initrd=initrd.img

9、生成ISO镜像文件

[root@localhost ~]# declare -x discinfo=`head -1 .discinfo`
[root@localhost ~]#  createrepo -u "media://$discinfo" -g repodata/*-comps.xml /data/OS/
[root@localhost ~]# mkisofs  -r -l -allow-multidot -allow-leading-dots -no-bak -o /data/kingsoft_centos6.3_1.0.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -input-charset UTF-8 /data/OS/

10、生成MD5校验码
[root@localhost ~]# /usr/bin/md5sum /data/kingsoft_centos6.3_1.0.iso 
2de68609b36db23cca4956b2779465ed  /data/kingsoft_centos6.3_1.0.iso

本文转自flyingzf  51CTO博客,原文链接:http://blog.51cto.com/flyingzf/1768786,如需转载请自行联系原作者

封装自己的LINUX光盘相关推荐

  1. Linux的软件包封装格式有,linux软件安装包详解---全

    详细介绍了常见的四种Linux应用软件安装包及其安装方法. 一.解析Linux应用软件安装包,通常Linux应用软件的安装包有四种: 1) tar包,如software-1.2.3-1.tar.gz. ...

  2. edHat linux光盘引导,Red Hat Linux 9光盘启动安装过程

    Red Hat Linux 9光盘启动安装过程 Red Hat Linux 9光盘启动安装过程 RedHat Linux是目前世界上使用最多的Linux寒作系统.因为它具备最好的图形界面,无论是安装. ...

  3. linux光盘安装yum,[转载]将linux安装光盘配置为一个本地yum源

    将redhat6.1Enterprise安装光盘配置为一个本地yum源======================================== 1.环境 redhat advanced Ent ...

  4. linux 光盘yum源搭建

    1.挂载光盘 2.进入 /etc/yum.repos.d 目录,修改其它配置文件后缀名 mv CentOS-Base.repo CentOS-Base.repo.bak mv CentOS-CR.re ...

  5. linux光盘补救,Linux_忘记root密码时使用Linux系统光盘进行补救的方法,救援模式即rescue ,这个模式主 - phpStudy...

    忘记root密码时使用Linux系统光盘进行补救的方法 救援模式即rescue ,这个模式主要是应用于,系统无法进入的情况.如,grub损坏或者某一个配置文件修改出错.如何使用rescue模式呢? 光 ...

  6. linux维护光盘,SystemRescueCd--基于Gentoo的Linux光盘维护系统

    使用Gentoo的朋友一定经历过安装过程的煎熬,而Gentoo的官方livecd提供的工具实在很少,如果你有一定的Linux基础和使用经验,那么使用SystemRescueCd安装Gentoo是一个不 ...

  7. linux系统调用的封装格式,ARM Linux系统调用的原理

    ARM Linux系统调用的原理ARM Linux系统调用的原理 操作系统为在用户态运行的进程与硬件设备进行交互提供了一组接口.在应用程序和硬件之间设置一个额外层具有很多优点.首先,这使得编程更加容易 ...

  8. 在linux安装光盘启动不了,linux光盘启动

    [以RedHat 7.3为例] 1.把安装盘的第一张放到光驱,然后重新启动机器,在BOIS中把系统用光驱来引导. 2.等安装界面出来后,按[F4]键,也就是linux rescue模式. 3.一系列键 ...

  9. linux光盘运行iso,如何在Windows,Mac和Linux上从光盘创建ISO文件 | MOS86

    An ISO文件是捆绑到单个文件中的CD或DVD的完整光盘映像.您可以安装ISO文件,使其可用作虚拟CD或DVD,允许您将物理光盘转换为虚拟光盘. 如果您想在现代计算机上使用旧游戏或软件光盘,则 IS ...

最新文章

  1. 引领深度学习潮流,刷屏计算机视觉顶会,揭秘商汤研究梦之队
  2. 【Android】Android取消EditText自动获取焦点
  3. WIDERFACE 数据集
  4. C/C++ 输出整数带正负号
  5. Unity3D4.* NGUI制作动态字库
  6. 8. Action过滤
  7. tensorflow训练神经网络时loss出现nan的问题
  8. 2021数据技术嘉年华线上召开,万人观看,迎接国产数据库的耕获菑畬之年
  9. PSD分层可临摹模板|无线端电商页面UI设计几个常见的错误
  10. [翻译] ZCSHoldProgress
  11. postgres 连接数查看与设置
  12. 开源阅读书源_阅读——开源阅读软件
  13. 开心游戏网页(附效果图)
  14. 行为型模式——模板方法模式
  15. SEO外语网站批量翻译软件
  16. c语言编写在线考试系统,c语言作业在线考试系统实现
  17. cocoscreator 接入 taptap 登录 防沉迷 实名认证
  18. Android studio Intent
  19. speedoffice表格如何冻结窗格?
  20. Esp8266 Node Mcu 一直乱码的问题详解

热门文章

  1. python时间模块time
  2. shell学习笔记(五)
  3. 西安力邦智能医疗amp;可穿戴设备沙龙--第1期---苹果HealthKit、谷歌GoogleFit来袭,智能医疗要爆发吗?...
  4. Linux Kernel代码艺术——数组初始化
  5. 利用Enterprise Library中的DAAB构造的数据库访问架构
  6. One-Pass Multi-task Convolutional Neural Networks for Efficient Brain Tumor Segmentation
  7. 3.2 Tensorflow基础运算
  8. 在工作中能学到的东西-2
  9. 单目视觉里程计的尺度问题的疑问?
  10. c语言输出合法的出栈算法,c语言栈的实现以及操作