自动安装流程

  • kickstart文件详解
# Kickstart file automatically generated by anaconda.
 
# 指定安装,不是升级
install
 
# 指定是光盘安装
cdrom
 
# 指定语言类型
lang zh_CN.UTF-8
 
# 指定键盘类型
keyboard us
 
# 指定
network --onboot yes --device eth0 --bootproto dhcp --noipv6
 
# 指定root密码,可以使用openssl passwd -1 -salt `openssl rand -hex 4` 手动生成
rootpw --iscrypted $6$jL10DQFoZb923wok$RNOE/orAwbICPRAMnaqXjU6YGTq4T1RCqkAEFUIIQqtQTdxTCWsvKAiVQJiCfhzTNFTxDLdo6nlrMscqEJoLG.
firewall --service=ssh
 
# 指定认证方式
authconfig --enableshadow --passalgo=sha512
 
# 安装系统后启动SELinux
selinux --enforcing
 
# 时区为上海
timezone --utc Asia/Shanghai
 
# 指明MBR路径,引导媒介,--append 为补充给内核的参数
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
 
# 指明分区配置
part /boot --fstype=ext4 --size=200
part / --fstype=ext4 --grow --asprimary --size=5000
part swap --size=2000
 
# 指明安装包的yum仓库使用光盘镜像
repo --name="CentOS" --baseurl=cdrom:sr0 --cost=100
 
# 指明安装包的yum仓库来自网络
url --url=http://192.168.23.10/cobbler
# 禁用防火墙
firewall --disabled
 
# 禁用SELinux
selinux --disabled
 
# 系统安装完毕之后重启
reboot
 
%packages
@base
@chinese-support
@compat-libraries
@core
@development
@dial-up
@server-platform-devel
@server-policy
@workstation-policy
sgpio
device-mapper-persistent-data
jpackage-utils
%end
 
# 安装前脚本,运行于微型系统上
%pre
 
# 安装后脚本,运行于安装完毕的系统上
%post
 
 
安装流程
 
 
 
(1)挂载安装光盘
 
(2)在/下创建/my目录,将光盘中的isolinux整个目录拷贝至/my/目录下,将自定义的kickstart文件拷贝至/my/目录下,现在在/my目录下存在isolinux目录和kickstart文件(通常命名为ks.cfg),并且设置isolinux的目录下的所有的文件权限为755
 
(3)通过mkisofs制作光盘镜像文件yhy.iso:mkisofs -R -J -T -v --no-emul-boot --boot-load-size 4 --boot-info-table -V "yhy CentOS 6 " -c isolinux/boot.cat -b isolinux/isolinux.bin -o /root/yhy.iso /my/
 
(4)创建好yhy.iso文件之后,上传到桌面
 
(5)将这个yhy.iso光盘挂载,在anaconda菜单界面,输入tab
 
(6)在后面加上 ks=cdrom:/ks.cfg ip=192.168.23.20 netmask=255.255.255.0 gateway=192.168.23.1 dns=114.114.114.114
 
(7)ks.cfg文件内容为
#platform=x86, AMD64, 或 Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'
# Root password
rootpw --iscrypted $1$OISvTrvh$yy.lEIxxfxLXcOLi.xl9a.
# System timezone
timezone Asia/Shanghai
# Use network installation
url --url="http://mirrors.aliyun.com/centos/6.9/os/x86_64"
# System language
lang en_US
# Firewall configuration
firewall --disabled
repo --name="CentOS" --baseurl=http://mirrors.aliyun.com/centos/6.9/os/x86_64/ --cost=100
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# SELinux configuration
selinux --disabled
 
# Network information
network --bootproto=dhcp --device=eth0
# Reboot after installation
reboot
# System bootloader configuration
bootloader --append="crashkernel=auto rhgb quiet" --location=mbr --driveorder="sda"
# Partition clearing information
clearpart --all
# Disk partitioning information
part swap --size=200
part / --asprimary --fstype="ext4" --grow --size=200
part /boot --fstype="ext4" --size=4000
 
%packages
@base
@chinese-support
@compat-libraries
@core
@development
@dial-up
@server-platform-devel
@server-policy
@workstation-policy
device-mapper-persistent-data
jpackage-utils
sgpio
 
%end

 

posted @ 2017-09-09 15:21  ~小学生~  阅读(223)  评论(0编辑  收藏  举报