概要
kickstartを作成して構築を自動化する
configファイル作成
ツールを起動
$ system-config-kickstart
ks.cfgの編集
$ cat ks.cfg
============================================================
#platform=x86, AMD64, 又は Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use CDROM installation media
cdrom
# Root password
rootpw --iscrypted $1$CtB.Pzeq$QqrTnMppy3YWq8IlLqGNz1
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
# System keyboard
keyboard jp106
# System language
lang ja_JP
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# Installation logging level
logging --level=info
# System timezone
timezone --isUtc Asia/Tokyo
# Network information
network --bootproto=static --device=eth0 --gateway=10.136.2.3 --ip=10.136.3.184 --nameserver=10.136.1.4 --netmask=255.255.128.0 --onboot=on
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part / --asprimary --fstype="ext4" --grow --size=1
============================================================
### 以下のような差分になるように編集
$ diff -u ks.cfg ks.cfg.org
============================================================
--- ks.cfg.org 2015-11-18 20:16:01.497243701 +0900
+++ ks.cfg 2015-11-18 20:28:37.054242782 +0900
@@ -12,6 +12,7 @@
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
+firstboot --disable
# System keyboard
keyboard jp106
# System language
@@ -35,3 +36,17 @@
clearpart --all --initlabel
# Disk partitioning information
part / --asprimary --fstype="ext4" --grow --size=1
+
+%packages
+make
+gcc-c++
+wget
+git
+openssh-clients
+telnet
+traceroute
+perl
+patch
+tcpdump
+
+%end
============================================================
MediaをマウントしてCDを作成する
VirtualBoxを利用して作成
OSを起動後、CDをmountする
### 必要なパッケージのインストール
# yum install mkisofs
### CDをマウント
# mount /dev/cdrom /media
### 作業ディレクトリの作成
# mkdir /root/CentOS6.7
### ディレクトリの移動
# cd /root/CentOS6.7
### CDのファイルをローカルにコピー
# find . -maxdepth 1 -mindepth 1 -exec cp -rp {} . \;
### ks.cfgをダウンロード
eddy6からおとせるようにする。後で修正する
### isolinux.cfgの編集
$ vi isolinux/isolinux.cfg
### 編集前後で以下のような差分になる
============================================================
--- /tmp/isolinux.cfg 2015-11-19 09:44:53.148817001 +0900
+++ isolinux/isolinux.cfg 2015-11-19 09:47:34.223314851 +0900
@@ -1,4 +1,5 @@
default vesamenu.c32
+default ks
#prompt 1
timeout 600
@@ -35,4 +36,7 @@
menu label ^Memory test
kernel memtest
append -
-
+label ks
+ menu label vmlinuz
+ kernel vmlinuz
+ append ks=cdrom:/ks.cfg initrd=initrd.img
============================================================
### isoファイルの作成
# mkisofs -v -r -J -o ../CentOS_6.7_kickstart.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table .
このisoを読み込んでVMを作ると自動で作成される