基于网络安装
创建kickstart文件的方式:
1.复制模板/root/anaconda-ks.cfg,而后使用vim编辑配置
2.使用system-config-kickstart来生成,建议使用/root/anaconda-ks.cfg 模板生成
ksvalidator:检查kiskstart文件的配置是否存在问题
把安装光盘中isolinux目录和生成的kickstart文件整体复制到/tmp/linuxiso/目录中
[root@ZYB ~]# ksvalidator linuxiso/ks.cfg
[root@ZYB ~]# cat /tmp/linuxiso/ks.cfg
# Kickstart file automatically generated by anaconda.
#version=DEVEL
install
# Use network installation
# Install from an installation tree on a remote server via FTP, HTTP, or HTTPS.
url --url="https://mirrors.aliyun.com/centos/6.9/os/x86_64/"
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --noipv6
# Root password:root
rootpw --iscrypted $1$T2k3LyqB$fZ7SCHyusvoc6nu7xejHX0
poweroff
firewall --enabled --service=ssh
#firewall --service=ssh
authconfig --enableshadow --passalgo=sha512uselinux --disabled
selinux --disabled
timezone Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all --drives=sda
zerombr
part /boot --fstype=ext4 --size=200
part pv.008002 --size=60000
volgroup vg_zyb --pesize=8192 pv.008002
logvol /my_data --fstype=ext4 --name=my_data --vgname=vg_zyb --size=10240
logvol / --fstype=ext4 --name=root --vgname=vg_zyb --size=15032
logvol swap --name=swap --vgname=vg_zyb --size=4000
logvol /usr --fstype=ext4 --name=usr --vgname=vg_zyb --size=20480
logvol /var --fstype=ext4 --name=var --vgname=vg_zyb --size=10240
repo --name="CentOS" --baseurl=https://mirrors.aliyun.com/centos/6.9/os/x86_64/ --cost=100
repo --name="Fedora EPEL" --baseurl=https://mirrors.aliyun.com/epel/6/x86_64/ --cost=100
%packages
@core
@development
@server-platform-devel
@server-policy
@workstation-policy
jpackage-utils
tree
wget
vim
lftp
%end
%post
echo -e 'ZYB HAHA\n' >> /etc/issue
sed -i '1,$s@id:[0-9]:initdefault:@id:3:initdefault:@g' /etc/inittab
cat>/etc/sysconfig/network<<EOF
NETWORKING=yes
HOSTNAME=ZYB
EOF
rm -rf /etc/yum.repos.d/*
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
cat>/root/.vimrc<<EOF
set number " 显示行号
set tabstop=4 " 设定 tab 长度为 4
EOF
%end
编辑文件/tmp/isolinux/isolinux.cfg,添加kickstart的路径如下:
制作光盘
[root@ZYB ~]# mkisofs -R -J -T -v --no-emul-boot --boot-load-size 4 --boot-info-table -V "Centos 6.9 X86_64 boot" -b isolinux/isolinux.bin -c isolinux/boot.cat -o /tmp/centos6.9.boot.iso /tmp/linuxiso/