Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6859669
  • 博文数量: 3857
  • 博客积分: 6409
  • 博客等级: 准将
  • 技术积分: 15948
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-02 16:48
个人简介

迷彩 潜伏 隐蔽 伪装

文章分类

全部博文(3857)

文章存档

2017年(5)

2016年(63)

2015年(927)

2014年(677)

2013年(807)

2012年(1241)

2011年(67)

2010年(7)

2009年(36)

2008年(28)

分类: 系统运维

2015-05-24 20:32:21

基于 Kickstart 自动化安装 CentOS 实践

[日期:2015-05-23] 来源:  作者:王奥OX [字体:  ]

前言

因为需要在浪潮的 x86 服务器中集中部署  搭建基于  的大数据平台 , 平时接触 SLES( Linux Enterprise Server) 较多并且已经实现基于 Autoyast 方式使用光盘或者 PXE 网络自动化安装 ( 后续会分享具体实现方法 )。 这次主要通过学习 Kickstart 实现最简单的光盘方式自动化安装 CentOS, 而网上的大多数教程并不完全适用于自身的环境 , 本文将不再赘述 Kickstart 相关概念 , 细节可参考扩展阅读 。

Kickstart 是最为通用的 Linux 自动化安装方法之一

扩展阅读

  • CentOS - 
  •  - 

环境准备

定制系统

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 isolinux.cfg

label linux
  menu label ^Install or upgrade an existing system
  menu default
  kernel vmlinuz
  append initrd=initrd.img ks=cdrom:/isolinux/ks.cfg # 手动增加 Kickstart 配置文件  vi ks.cfg
#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 # 如果是  的系统 , 会要求输入 key, 这里配置为跳过 , 如果不配置安装时会停在那里要求用户输入 key #key –skip #System language # 语言环境  #lang en_US.UTF-8 lang zh_CN.UTF-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/*comps.xml . 
mkisofs -o /tmp/CentOS-6.4_64_auto.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table  -joliet-long  -R -J -v -T /tmp/iso/

测试和建议

Linux 基础教程:Linux Kickstart 自动安装  

使用PXE+DHCP+Apache+Kickstart无人值守安装CentOS5.8 x86_64 

Linux PXE无人值守安装出现 PXE-E32:TFTP OPen timeout的解决办法 

使用PXE结合kickstart 自动安装Linux系统 

RHCE认证之无人值守安装Linux系统(FTP+TFTP+DHCP+Kickstart+PXE) 

PXE网络装机(有人值守与无人值守安装) 

更多CentOS相关信息见 专题页面 

本文永久更新链接地址

阅读(778) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~