Objective
Because of the need to centrally deploy CentOS in a tidal x86 server to build a large data platform based on Hadoop, usually contact SLEs (SuSE Linux Enterprise server) More and implemented automated installation of CD-ROM or PXE network based on Autoyast (subsequent sharing of specific implementation methods). This is mainly through learning kisckstart to achieve the simplest way to automate the installation of optical disk CentOS, while most of the online tutorials are not fully applicable to their own environment, this article will no longer repeat the kickstart related concepts, details can be referred to the extended reading.
Kickstart is one of the most common methods of Linux automation installation
Environmental preparedness
Custom Systems
Centos-6.4-x86_64
Official Download Address-http://wiki.centos.org/Download
Installing packages
Agent Internet tips, export http_proxy=ip:port
The code is as follows:
Yum-y Install Createrepo Mkisofs
Production process
Directory structure
Copy CentOS original mirror content, do not do any streamlining
The code is as follows:
Mkdir/mnt/centos
Mount/dev/sr0/mnt/centos
Mkdir/tmp/iso
Cp-r/mnt/centos/*/tmp/iso
Add Kickstart configuration file
File path and installation method can be defined freely
Copy Code
The code is as follows:
Cd/tmp/iso/isolinux
#修改引导, pay attention to the ks= part.
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
< p> #Kickstart file automatically generated by Anaconda.
#version =devel
#Install OS instead of upgrade
#表示是安装 instead of upgrading
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的系统, you will be required to enter key, which is configured to skip, and if you do not configure the installation will stop there and require the user to enter 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 the ' I ' Boot
#禁用第一次启动时设置系统的向导
Firstboot--disable
#System Authorization Information
#用户认证配置, Useshadow represents the use of local authentication,--passalgo represents a cryptographic algorithm
Authconfig--enableshadow--passalgo=sha512
#System timezone
#设置时区为上海
TimeZone--ISUTC Asia/shanghai
#System bootloader Configuration
#指明bootloader的安装位置, indicating the ordering of the drive, indicating the parameters passed to the kernel after the operating system installation is complete
bootloader--location=mbr--driveorder=sda--append= "Crashkernel=auto rhgb"
#Clear the Master Boot record
#清除MBR引导记录
ZEROMBR Yes
#Partition Clearing Information
#清除硬盘上的所有数据
Clearpart--all--initlabel
#Disk Partitioning Information
#自定义分区
#创建一个200M大小的分区挂载/boot Type is EXT4
Part/boot--FSTYPE=EXT4--size=200--ONDISK=SDA
#创建一个20000M大小的SWAP分区
Part swap--size=20000--ONDISK=SDA
#创建/Directory
Part/--FSTYPE=EXT4--grow--size=1--ONDISK=SDA
#Reboot after installation
#设置完成之后重启
Reboot--eject
#This packages is for CentOS 6.4
#为CentOS 6.4 Customized Packages
%packages
@base
@core
@chinese-support
#增加安装后运行脚本
%post
#config Service
#自定义服务
Service NetworkManager Stop
Chkconfig NetworkManager off
#eject CDROM
#安装完成弹出光碟
#eject
#reboot
#执行完毕后重启
#reboot-F
#结束自动化部署
%end
Build dependencies and ISO files
Note the accuracy of the path and the command
The code is as follows:
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/