kickstart无人值守自动安装配置

KickStart是一种无人职守安装方式。KickStart的工作原理是通过记录典型的安装过程中所需人工干预填写的各种参数,并生成一个名为ks.cfg的文件;在其后的安装过程中(不只局限于生成KickStart安装文件的机器)当出现要求填写参数的情况时,安装程序会首先去查找KickStart生成的文件,当找到合适的参数时,就采用找到的参数,当没有找到合适的参数时,才需要安装者手工干预。这样,如果KickStart文件涵盖了安装过程中出现的所有需要填写的参数时,安装者完全可以只告诉安装程序从何处取ks.cfg文件,然后去忙自己的事情。等安装完毕,安装程序会根据ks.cfg中设置的重启选项来重启系统,并结束安装。

一、安装

查看是否安装

[root@localhost pxeboot]# rpm -qa |grep  system-config-kickstart
system-config-kickstart-2.8.6.6-1.el6.noarch

未安装请执行

[root@localhost pxeboot]# yum install -y system-config-kickstart

二、设置kickstart的cfg配置

[root@localhost pxeboot]# system-config-kickstart

执行命令后,会出现如下界面,在界面内选择好语言环境,时间区域,设置root密码。记得勾选安装后重启

image

设置从哪里获取iso文件(我这里写的是7的,但我最后操作的是6.7的,需要注意一下,这个地方修改一下)

image

设置磁盘

image

设置网络设备

image

禁止SELinux和防火墙

image

选择你默认安装的系统软件

image

image

保存cfg文件 为kinggoo_ks_centos6.7.cfg

image

查看cfg文件内容

[root@localhost centos_x64_6.7]# cat kinggoo_ks_centos6.7.cfg

[root@localhost centos_x64_6.7]# cat kinggoo_ks_centos6.7.cfg 
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use NFS installation media
nfs --server=10.0.147.100 --dir=/systemiso/centos_x64_6.7
# Root password "这里我设置的root密码是kinggoo.com"
rootpw --iscrypted $1$nYuangux$gku1kFUs3rUr2poP06869.
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info
# Reboot after installation 
reboot 

# System timezone
timezone  Asia/Shanghai
# Network information
network  --bootproto=dhcp --device=eth0 --onboot=on
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel 
# Disk partitioning information
part / --fstype="ext4" --size=10000
part /boot --fstype="ext4" --size=300

%packages
@base
@basic-desktop
@chinese-support
@console-internet
@desktop-debugging
@desktop-platform
@directory-client
@fonts
@general-desktop
@graphical-admin-tools
@input-methods
@internet-applications
@internet-browser
@kde-desktop
@legacy-x
@network-tools
@remote-desktop-clients
@x11

%end

三、修改配置

1)编辑kickstart的cfg文件

找到上面配置好的kickstart 配置文件 “kinggoo_ks_centos6.7.cfg ”

拷贝到“/systemiso/centos_x64_6.7/”内

编辑 kinggoo_ks_centos6.7.cfg ,如配置文件内没有reboot重启命令,则请在

logging –level=info

# Reboot after installation

# 添加 reboot

reboot

最后目录结构是(这个kinggoo_ks_centos6.7.cfg需要能使用ftp或者http,nfs等方式访问哦)

image

2)编辑boot默认菜单

[root@localhost ~]# cat /tftpboot/pxelinux.cfg/default

timeout 100
default menu.c32
 
menu title ########## PXE Boot Menu - KingGoo ##########

label 1
   menu label ^1) Install CentOS 6 - NFS
   kernel centos_x64_6.7/vmlinuz
   append initrd=centos_x64_6.7/initrd.img method=nfs:10.0.147.100:/systemiso/centos_x64_6.7
label 2
   menu label ^2) Install CentOS 7 - NFS
   kernel centos_x64_7/vmlinuz
   append initrd=centos_x64_7/initrd.img method=nfs:10.0.147.100:/systemiso/centos_x64_7

label 3
   menu label ^3) Install CentOS 7 - HTTP
   kernel centos_x64_7/vmlinuz
  append initrd=centos_x64_7/initrd.img method=http://10.0.147.100/centos_x64_7
         
label 5
   menu label ^5) Install CentOS 6.7 - Kickstart
   kernel centos_x64_6.7/vmlinuz
   append initrd=centos_x64_6.7/initrd.img  ks=http://10.0.147.100/centos_x64_6.7/kinggoo_ks_centos6.7.cfg

         
label 10
   menu label ^10) Boot from local drive
         menu default
   localboot

image

保存后,确保服务没问题,重新启动实验机器

四、启动

image

故意弄错了nfs地址,截了个图,看到了吧 是从网上下载cfg文件的

image

正确的

image

image

image

都是自动了,不需要干预。 我就不截图了

- THE END -
版权声明:
转载原创文章请注明,文章出处://kinggoo.com
原文地址:https://kinggoo.com/kickstartos.htm
发表评论?

1 条评论。

发表评论


此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据