设为首页 收藏本站
查看: 970|回复: 0

[经验分享] CentOS 7.1全自动安装光盘制作详解

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-5-18 08:54:29 | 显示全部楼层 |阅读模式
    安装系统的话,常用方式就是通过U盘,光盘,kickstart网络自动化安装,网络自动化安装固然好,但是有时候在现场做项目的话根本就没有kickstart环境,甚至连基本的网络建设都没有弄好,此时该如何安装系统呢,通过u盘或者光盘,手动安装的话需要很多选项要自己填写,那么我们能不能把自动化的ks环境做到系统镜像里面去呢,答案是很定的,接下来我们就来介绍CentOS 7.1全自动安装光盘制作
第一步我们挂载原始光盘镜像,假如挂载点是/mnt/cdrom,然后做如下操作


cp -ar /mnt/cdrom/* /tmp/martin/
cp -ar /mnt/cdrom/.treeinfo /tmp/martin/
cp -ar /mnt/cdrom/.discinfo /tmp/martin/
createrepo -g/tmp/martin/repodata/*-comps.xml /tmp/martin/

[iyunv@kvm-vm3 isolinux]# pwd
/tmp/martin/isolinux
[iyunv@Brisbane3-vm3 isolinux]# ls
boot.cat grub.conf   isolinux.bin  ks_a.cfg ks_raid_ab.cfg memtest     TRANS.TBL    vesamenu.c32
boot.msg initrd.img  isolinux.cfg  ks_b.cfg ks_raid_bc.cfg  splash.png  upgrade.img vmlinuz

在该目录下面新建四个ks文件,其实只要一个即可,这里做成四个是为了硬盘不同的分区方案而做的,
这里我们只介绍一个ks_raid_ab.cfg的配置,其实就是一份定义了软raid的分区
# platform=x86, AMD64, or Intel EM64T

# Use text mode install
#text
# Use graphical install
graphical

# Install OS instead of upgrade
install

# Use CDROM media
cdrom

# Use NFS installation media
#nfs --server=172.16.15.10 --dir=/centosinstall

# Use HTTP installation media

#url --url ftp://172.16.15.10/Public/iso/7.1-x64/

# Use FTP installation media
#url --url ftp://<username>:<password>@<server>/<dir>
#url --url ftp://172.16.15.10/

# System language
lang en_US.UTF-8
# System keyboard
keyboard us

# Network information

network --bootproto=dhcp  --hostname martin --onboot=on

#Root password
rootpw  123456

#firewall --enabled --ssh  
firewall --disable  

# System authorization information
authconfig --useshadow  --enablemd5

# SELinux configuration
selinux --disabled

# System timezone
timezone Asia/Shanghai

# System bootloader configuration
bootloader --location=mbr

# Partition clearing information
#clearpart --all --initlabel --drives=sda
#part /boot --fstype="ext4" --size=300 --ondisk=sda
#part pv.01 --size=4096 --grow --ondisk=sda
#volgroup VolGroup00 --pesize=32768 pv.01
#logvol / --fstype="ext4" --name=LogVol00 --vgname=VolGroup00  --size=1024 --grow  
#logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=512

# Partition clearing information
clearpart --all --initlabel
# Soft RAID1 partitioning information
part swap --fstype="swap" --ondisk=sda --size=4096
part raid.01 --fstype="raid" --grow --ondisk=sda --size=1
part swap --fstype="swap" --ondisk=sdb --size=4096
part raid.02 --fstype="raid" --grow --ondisk=sdb --size=1
raid / --device=md0 --fstype="ext4" --level=1 raid.01 raid.02



# Reboot after installation
reboot

# Do not configure the X Window System; if to configure it, uncomment following line
skipx
# X Window System configuration information
#xconfig  --defaultdesktop=GNOME --depth=32 --resolution=1024x768


%packages
@ additional-devel
@ base
@ core
@ debugging
@ gnome-desktop
@ development
@ mariadb
@ emacs
@ web-server
@ network-file-system-client
@ java-platform
@ platform-devel
@ php

expect
iptraf-ng
libaio-devel
libpcap-devel
lksctp-tools
lrzsz
nasm
net-snmp-utils
php-mysql
php-pear
php-soap
system-config-kickstart

# Add these system perfomance enhanced tools
vsftpd
logwatch
postfix
nmap-ncat
nmap
ftp
telnet
lsscsi
# Update the sysstat version from 9.0.4 to 10.1.6
sysstat
%end

[iyunv@kvm-vm3 isolinux]# vim isolinux.cfg  修改该文件,增加如下内容
label ks_a
menu label ^Custom ks_a CentOS 7 --This is sinlgle_a
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:/dev/cdrom inst.ks=cdrom:/isolinux/ks_a.cfg

label ks_b
menu label ^Custom ks_b CentOS 7 --This is sinlgle_b
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:/dev/cdrom inst.ks=cdrom:/isolinux/ks_b.cfg


label ks_ab
menu label ^Custom ks_ab CentOS 7 --This is raid_ab
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:/dev/cdrom inst.ks=cdrom:/isolinux/ks_raid_ab.cfg

label ks_bc
menu label ^Custom ks_bc CentOS 7 --This is raid_bc
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:/dev/cdrom inst.ks=cdrom:/isolinux/ks_raid_bc.cfg

此时我们将该目录/tmp/martin/   重新生成镜像即可,centos7.1原始镜像有7个多G,我们可以对其做裁剪,方法我们下次介绍






运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-218461-1-1.html 上篇帖子: 搭建cadvisor + influxdb + grafna 监控系统 下篇帖子: ifconfig、ip命令详解、route路由配置、DNS配置 光盘制作
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表