Detailed kickstart
- Kickstart file formats Official Description:
Installation Guide for Cents 6
Installation Guide for 7 Cents
kickstart file
First to understand the basic contents of the kickstart file What
Kickstart file format
1. 命令段:指明各种安装前配置,如键盘类型等
2. 程序包段:指明要安装的程序包组或程序包,不安装的程序包等
3. 脚本段:
+ %pre: 安装前脚本
运行环境:运行于安装介质上的微型Linux环境
+ %post: 安装后脚本
运行环境:安装完成的系统
1. The command segment command
- Essential Order
- auth
Authentication Configuration
- bootloader
installation position and configuration of #bootloader - Keyboard
# set keyboard type - lang
# language type - Part
# create a partition - rootpw
# specify the root password - TimeZone
# time zone
- Optional command
- install or upgrade
# is a new installation or an update - text
# text installation interface - Network
# NIC configuration - Firewall
# Firewall configuration - selinux
# Configure selinux - poweroff
- reboot
- repo
- user
# After the installation is complete, create a new user to the system - URL
# indicated installation source - the --skip Key
# skip the installation number for rhel version
- install or upgrade
2. Package segment
%packages
package #要安装的包
@development #要安装的包组
-byacc #不安装的包
%end
3. script segment
pre-install script
%pre
i am pre
%end
After installation script
%post
i am post
%end
Detailed kickstart file generation
Read the kickstart file format should be confused and did not know what to speak. So Here we have a detailed talk about what kickstart file.
He said that the kickstart
configuration file. In fact, I was speaking system-config-kickstart
of this program, as a beginner, if we write directly to kickstart
the profile we can not be written. We can modify and generate a new configuration based on a template /root/anaconda-ks.cfg
. B. We can use system-config-kickstart
this to generate UI interface.
Note: This program is a graphical interface, if you minimize installation (minimal), even if the installation is not running, oh.
Next, we use the side of system-config-kickstart
the side to look at the generated kickstart
configuration file, page by page to us.
1. Basic Configuration
Configuration files are as follows
┌────────────────────────────────────────────────────────┐
│#Basic Configuration
│========================================================
│#platform=x86, AMD64, or Intel EM64T
│#Default Language默认语言
│lang en_US
│# Keyboard 键盘
│keyboard 'us'
│# timezone 时区(勾选了"Use UTC clock" 会追加[--isUtc])
│timezone Asia/Shanghai
│# Root password
│rootpw --iscrypted $1$DBk7xfJp$Agxd303XUAfRKIf7gB8DG/
└──────────────────────────────────────────────────────────┘
┌────────────────────────────────────────────────────────┐
│#Advanced Configuration
│勾选就有,不勾没有
│========================================================
│# Reboot after installation
│reboot
│# Use text mode install
│text
└────────────────────────────────────────────────────────┘
2. Installation Method
Configuration files are as follows
┌────────────────────────────────────────────────────────┐
│#Installation Method
│========================================================
│# Install OS instead of upgrade
│install
│# Upgrade existing installation
│upgrade
└────────────────────────────────────────────────────────┘
┌────────────────────────────────────────────────────────┐
│#Installation source
│选了哪项就写哪项
│========================================================
│# Use CDROM installation media
│cdrom
│# Use NFS installation media
│nfs --server=服务器 --dir=目录
│# Use network installation
│url --url="ftp://用户名:密码@服务器/目录"
│# Use network installation
│url --url="http://服务器/目录"
│# Use hard drive installation media
│harddrive --dir=目录 --partition=分区
└────────────────────────────────────────────────────────┘
3. Boot Loader Options
Configuration files are as follows
┌────────────────────────────────────────────────────────────────┐
│#Installation Method&GRUB options&Install Options
│=================================================================
│ ┌────────────────────────────────────┐
│ │ 选择了Do not install a boot loader │
│ └────────────────────────────────────┘
│ # System bootloader configuration
│ bootloader --location=none
│
│ ┌────────────────────────────────────┐
│ │ 选择了install new boot loader │
│ └────────────────────────────────────┘
│ bootloader --append="ker" --location=mbr --password="123"
│#append是内核参数,location是bootloader安装位置,password是GRUB密码
└────────────────────────────────────────────────────────────────┘
4. Partition Information
Configuration files are as follows
┌─────────────────────────────────────────────────────┐
│# Master Boot Record
│#Master Boot Record选择了clear... 否则就没有
│======================================================
│# Clear the Master Boot Record
│zerombr
└─────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────┐
│# Partitions&Disk Label
│======================================================
│# Partition clearing information
│clearpart --linux --initlabel
└─────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────┐
│# Layout 分区
│part 挂载点 --fstype=文件系统 --size=大小(单位M)
│======================================================
│# Disk partitioning information
│part / --fstype="xfs" --size=10240
│part /boot --fstype="ext4" --size=1024
│part swap --fstype="swap" --size=2048
└─────────────────────────────────────────────────────┘
5. Network Configuration
Configuration files are as follows
┌─────────────────────────────────────────────────────┐
│# Network Configuration
│Centos7如果要写eth0,要加内核参数net.ifnames=0
│======================================================
│# Network information
│network --bootproto=dhcp --device=eth0
└─────────────────────────────────────────────────────┘
6. Authentication
Configuration files are as follows
┌───────────────────────────────────────────────────────────────┐
│# Authentication
│如果勾选Enable Fingerprint reader则追加参数 --enablefingerprint
│===============================================================
│# System authorization information
│auth --useshadow --passalgo=md5
└───────────────────────────────────────────────────────────────┘
7. Firewall Configuration
Configuration files are as follows
┌───────────────────────────────────────────────────────────────┐
│# Firewall Configuration
│===============================================================
│# SELinux configuration
│selinux --disabled或permissive或enforcing
│
│# Firewall configuration
│firewall --disabled或enabled
│#如果是enable,可以在追加:--http --ftp --telnet --smtp --ssh
│#还可以追加端口:--port=555:tcp,444:udp
└───────────────────────────────────────────────────────────────┘
8. Display Configuration
Configuration files are as follows
┌───────────────────────────────────────────────────────────────┐
│# Display Configuration
│===============================================================
│如果选了安装图形界面,就没有下面这句话
│# Do not configure the X Window System
│skipx
│# Run the Setup Agent on first boot
│firstboot --enable或disable
└───────────────────────────────────────────────────────────────┘
9. Package Selection
If your interface is nothing, so now you need to use the yum repository configuration files change it
[root]$ vim /etc/yum.repos.d/***.repo
[development]
#把原来"[]"内的内容改成development就可以了,其它不变
Configuration files are as follows
%packages
@development
-byacc
-cscope
-ctags
-diffstat
-doxygen
-elfutils
-gcc-gfortran
-git
-indent
-intltool
-patchutils
-rcs
-subversion
-swig
-systemtap
%end
10. Pre-Installation Script
Configuration files are as follows
%pre
这里写你的脚本
%end
11. Post-Installation Script
Configuration files are as follows
%post --nochroot
这里写你的脚本
%end
example kickstart file
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'
# Root password
rootpw --iscrypted $1$2TeoFGRN$EeykyMirEiMIya57QmbG71
# Use network installation
url --url="http://192.168.88.7/Centos/7/os/x86_64"
# System language
lang zh_CN
# System authorization information
auth --useshadow --passalgo=sha512
# Use text mode install
text
# Run the Setup Agent on first boot
firstboot --enable
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# Firewall configuration
firewall --disabled
# Network information
network --bootproto=dhcp --device=eth0
# Reboot after installation
reboot
# System timezone
timezone Asia/Shanghai
# System bootloader configuration
bootloader --append="net.ifnames=0" --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype="ext4" --size=2048
part / --fstype="xfs" --size=10240
part swap --fstype="swap" --size=2048
%pre
i am 安装前脚本
%end
%post --nochroot
i am 安装后脚本
%end
%packages
@development
-byacc
-cscope
-ctags
-diffstat
-doxygen
-elfutils
-gcc-gfortran
-git
-indent
-intltool
-patchutils
-rcs
-subversion
-swig
-systemtap
%end
Experiment: Specifies the kickstart file system installation
We talk so much, what use is it. Yes, of course, we can use our above made ks file to automatically install the system. Linux foundation _ ultra-detailed VMware virtual machine installation CentOS7 , you can see, the system installation is relatively cumbersome, with the ks file, we do not have little point. details as follows:
-
Create a new virtual machine
-
Then we see the figure little point
-
Here we must pay attention to the election of the card connection mode to be able to even get on your http server, http server stood installation source, which is above ks inside this file:
# Use network installation
url --url="http://192.168.88.7/Centos/7/os/x86_64"
-
Boot into the CD, press the ECSbutton
-
Enter the file you just created ks, you can also put your http server
/var/www/html/
directory, thenlinux ks=http://192.168.88.1/你的ks文件
, depends on your specific file on which the. If you choose the wrong card mode, and you can not http server connection, then it will error.
-
Enter, get automatically installed, do not have hands full. ks If you write your own, it is inevitable to cope point unknown problems, it is recommended beginner or a
system-config-kickstart
program to generate. You can also use a syntax error checking ks file command:
ksvalidator 你的ks文件
Naing
While the mouse is little point, but there will still be the wrong choice, here we collected some frequently asked questions:
- System installation process appears
Error processing drive:pc1-0000....
Ks few lines of your files under examination, may be wrong
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
- System installation process appears
Unable to read package metadata. This may be due to a missing repodata directory...
Check your line, there should be an error
# Use network installation
url --url="http://192.168.88.2/centos/7/"