利用Kickstart自动化安装CentOS的方法
来源:学问馆 本文已影响2.48W人
来源:学问馆 本文已影响2.48W人
因为需要在浪潮的x86服务器中集中部署CentOS搭建基于Hadoop的大数据平台,平时接触SLES(SuSE Linux Enterprise Server)较多并且已经实现基于Autoyast方式使用光盘或者PXE网络自动化安装(后续会分享具体实现方法)。这次主要通过学习Kisckstart实现最简单的光盘方式自动化安装CentOS,而网上的大多数教程并不完全适用于自身的环境,本文将不再赘述Kickstart相关概念,细节可参考扩展阅读。
Kickstart是最为通用的Linux自动化安装方法之一
环境准备
定制系统
CentOS-6.4-x86_64
官方下载地址 -
安装软件包
代理上网小技巧,export http_proxy=ip:port
yum -y install createrepo mkisofs
制作流程
目录结构
拷贝CentOS原始镜像内容,不做任何精简
mkdir /mnt/centos
mount /dev/sr0 /mnt/centos
mkdir /tmp/iso
cp -r /mnt/centos/* /tmp/iso
增加Kickstart配置文件
文件路径和安装方式可自由定义
cd /tmp/iso/isolinux
#修改引导,注意ks=部分
vi
label linux
menu label ^Install or upgrade an existing system
menu default
kernel vmlinuz
append initrd= ks=cdrom:/isolinux/
#手动增加Kickstart配置文件
vi
#Kickstart file automatically generated by anaconda.
#version=DEVEL
#Install OS instead of upgrade
#表示是安装,而不是升级
install
#Use text mode install
#文本方式安装
text
#Use network installation
#使用网络安装
#url --url=ftp://ip/centos
#Local installation Use CDROM installation media
#使用光盘安装
cdrom
#Installation Number configuration
#如果是RedHat的系统,会要求输入key,这里配置为跳过,如果不配置安装时会停在那里要求用户输入key
#key ?skip
#System language
#语言环境
#lang en_-8
lang zh_-8
#System keyboard
#键盘类型
keyboard us
#Network information
#网络配置
#network --device eth0 --bootproto dhcp --onboot yes
#Root password
#root密码
rootpw chinaums
#Firewall configuration
#禁用防火墙
firewall --disabled
#SELinux configuration
#禁用selinux
selinux --disabled
#Run the Setup Agent on first boot
#禁用第一次启动时设置系统的向导
firstboot --disable
#System authorization information
#用户认证配置,useshadow表示使用本地认证,--passalgo表示密码加密算法
authconfig --enableshadow --passalgo=sha512
#System timezone
#设置时区为上海
timezone --isUtc Asia/Shanghai
#System bootloader configuration
#指明bootloader的安装位置,指明驱动器的排序,指明操作系统安装完成之后,向内核传递的参数
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
#Clear the Master Boot Record
#清除MBR引导记录
zerombr yes
#Partition clearing information
#清除硬盘上的.所有数据
clearpart --all --initlabel
#Disk partitioning information
#自定义分区
#创建一个200M大小的分区挂载/boot类型为ext4
part /boot --fstype=ext4 --size=200 --ondisk=sda
#创建一个20000M大小的SWAP分区
part swap --size=20000 --ondisk=sda
#创建/目录
part / --fstype=ext4 --grow --size=1 --ondisk=sda
#Reboot after installation
#设置完成之后重启
reboot --eject
#This packages is for CentOS 6.4
#为CentOS 6.4定制的软件包
%packages
@base
@core
@chinese-support
#增加安装后运行脚本
%post
#config service
#自定义服务
service NetworkManager stop
chkconfig NetworkManager off
#eject cdrom
#安装完成弹出光碟
#eject
#reboot
#执行完毕后重启
#reboot -f
#结束自动化部署
%end
生成依赖关系和ISO文件
注意路径和命令的准确性
cd /tmp/iso
createrepo -g repodata/* .
mkisofs -o /tmp/CentOS-6.4_64_ -b isolinux/ -c isolinux/ -no-emul-boot -boot-load-size 4 -boot-info-table -joliet-long -R -J -v -T /tmp/iso/
i recall with embarrassing clarity the flavor of those particular ashes ?
关于哪一种职业加班的情况比较多? What Kind of Jobs use to Work Overtime?英语作文
Lesson 18《Jenny Writes a Postcard》英语教学设计范文
评课稿:skim and match the pictures with each paragraph
英语四级考试备考作文Protecting the Intangible Cultural Heritages训练题
MacBook Pro with Retina display 不适合做网页设计吗?
英文简历(市场助理)MARKETING ASSISTANT
ADMINISTRATIVE ASSISTANT(Personnel)电子简历模板
making changes-getting rid of bad habits时尚口语
clothes什么意思 clothes+clothing+dress等近义词用法辨析
Taking-pictures的教学反思
Talking About Occupations 谈论职业
Michael Jackson经典曲《beatit》儿童舞蹈慢动作教学及歌词
ARCGIS DESKTOP 安装步骤图文教程
Fukushima Watch: Authority Chairman Not Convinced Level 3 Needed
PEP4 Unit3 Is this your skirt英语评课稿
Snapchat 为何开始试水类 Path 的 ‘Stories’ 社交功能?
acknowledgements怎么写-英语论文Acknowledgements
语文倒装句的用法
8B Unit 3 Integrated skills的评课稿
三年级英语下册Lesson6《Seeing the doctor》教学反思
葡萄牙语的历史:Revolucionários apossam-se de Porto Alegre
为什么电脑每次开机都会出现检查Checking file system on C
To Be Or Not To Be, That Is the Question英文读后感
利用数学来说课稿的方法
高二化学实用的学习方法
有效利用空余时间的方法
关于期末的英语作文:The Benefits of Keeping Diaries
Michael Jackson歌曲Give in to me相关介绍
Unit Three is this your skirt教学设计范文
对Unit8 Mocky is late第一课时的课后反思
《themostinterestingstories》的课后反思
酒店英语:抱怨服务Complaining about the Service
教你时尚英语必备47 trying to concentrate
英语作文:广告是诅咒 Advertisement is a Curse
惠普 Presario CQ43 Notebook PC 笔记本电脑可以全开特效玩龙之谷吗
Adoption of the Declaration of Human Rights演讲稿
DiskMaker -X制作Yosemite安装U盘教程
六年级下册Lesson19《Let’s go to the park》教学反思
初三英语作文之My Strengths and Weaknesses
CentOS 7.0编译安装Nginx+MySQL+PHP的方法