Detailed step by step _kickstart

Detailed kickstart

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
    1. auth

    Authentication Configuration

    1. bootloader
      installation position and configuration of #bootloader
    2. Keyboard
      # set keyboard type
    3. lang
      # language type
    4. Part
      # create a partition
    5. rootpw
      # specify the root password
    6. TimeZone
      # time zone
  • Optional command
    1. install or upgrade
      # is a new installation or an update
    2. text
      # text installation interface
    3. Network
      # NIC configuration
    4. Firewall
      # Firewall configuration
    5. selinux
      # Configure selinux
    6. poweroff
    7. reboot
    8. repo
    9. user
      # After the installation is complete, create a new user to the system
    10. URL
      # indicated installation source
    11. the --skip Key
      # skip the installation number for rhel version

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 kickstartconfiguration file. In fact, I was speaking system-config-kickstartof this program, as a beginner, if we write directly to kickstartthe 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-kickstartthis 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-kickstartthe side to look at the generated kickstartconfiguration file, page by page to us.

1. Basic Configuration

Here Insert Picture Description

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

Here Insert Picture Description

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

Here Insert Picture Description

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

Here Insert Picture Description

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

Here Insert Picture Description

Configuration files are as follows

┌─────────────────────────────────────────────────────┐# Network Configuration
│Centos7如果要写eth0,要加内核参数net.ifnames=0======================================================# Network information
│network  --bootproto=dhcp --device=eth0
└─────────────────────────────────────────────────────┘

6. Authentication

Here Insert Picture Description

Configuration files are as follows

┌───────────────────────────────────────────────────────────────┐# Authentication
│如果勾选Enable Fingerprint reader则追加参数 --enablefingerprint===============================================================# System authorization information
│auth  --useshadow  --passalgo=md5
└───────────────────────────────────────────────────────────────┘

7. Firewall Configuration

Here Insert Picture Description

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

Here Insert Picture Description

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

Here Insert Picture Description

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

Here Insert Picture Description

Configuration files are as follows

%pre
这里写你的脚本
%end

11. Post-Installation Script

Here Insert Picture Description

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:

  1. Create a new virtual machine
    Here Insert Picture Description

  2. Then we see the figure little point
    Here Insert Picture Description

  3. 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"

Here Insert Picture Description

  1. Boot into the CD, press the ECSbutton
    Here Insert Picture Description

  2. Enter the file you just created ks, you can also put your http server /var/www/html/directory, then linux 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.
    Here Insert Picture Description

  3. 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-kickstartprogram 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:

  1. System installation process appearsError 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
  1. System installation process appearsUnable 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/"

Guess you like

Origin blog.csdn.net/weixin_42758707/article/details/94738936