どこかにメモをしようとおもったけどブログの記事をまるで書いてないのを思いだしました.
CentOS 7.2前提
1. CentOSのisoイメージをダウンロード
2. /mnt/centosにisoイメージの中身を全部そのまま配置
3.
次を実行
4.
これを/etc/dnsmasq.confにする.
enp8s0は自分の環境のインターフェース名に変える.
5.
/var/tmp/tftpbootに次の中身でgrub.cfgを作成
6. kickstartのコンフィグファイルをks.cfgという名前で/mnt/centos/に配置
7.
これで自動でPXE Bootして,Kickstartでインストールしてくれるはず.
もしKickstartを使わず手動インストーラをぽちぽちするならば,
2.で/mnt/centosにファイルを配置とかじゃなくてisoを直接マウントして,
grub.cfgのカーネルコマンドラインからks=の部分を削除すれば大丈夫です.
CentOS 7.2前提
1. CentOSのisoイメージをダウンロード
2. /mnt/centosにisoイメージの中身を全部そのまま配置
3.
次を実行
$ mkdir -p /var/tmp/tftpboot(もしかしたらgrubx64.efiは/mnt/centos/Packages/grub2-efi-なんとか.rpmを解凍してgrubx64.efiを取り出さないといけないかも)
$ cp /mnt/centos/EFI/BOOT/grubx64.efi /var/tmp/tftpboot/
$ cp /mnt/centos/images/pxeboot/{vmlinuz,initrd.img} /var/tmp/tftpboot
4.
これを/etc/dnsmasq.confにする.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
port=0 | |
interface=enp8s0 | |
bind-interfaces | |
dhcp-range=192.168.0.50,192.168.0.150,12h | |
enable-tftp | |
dhcp-match=set:efi-x86_64,option:client-arch,7 | |
dhcp-boot=tag:efi-x86_64,grubx64.efi | |
tftp-root=/tmp/tftpboot |
enp8s0は自分の環境のインターフェース名に変える.
5.
/var/tmp/tftpbootに次の中身でgrub.cfgを作成
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set timeout=1 | |
menuentry 'CentOS' { | |
linuxefi vmlinuz ip=dhcp inst.repo=http://192.168.0.1/ ks=http://192.168.0.1/ks.cfg | |
initrdefi initrd.img | |
} |
6. kickstartのコンフィグファイルをks.cfgという名前で/mnt/centos/に配置
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# インストールの開始 | |
install | |
# 対話を自動進行 | |
autostep | |
# インストール完了後に再起動 | |
reboot | |
# 暗号化アルゴリズム | |
auth --enableshadow --passalgo=sha512 | |
# システムの初回ブートでfirstbootを開始 | |
firstboot --enable | |
# インストールディスクを指定 | |
ignoredisk --only-use=sda | |
# キーボードレイアウト | |
keyboard --vckeymap=us --xlayouts='us' | |
# システムのロケール | |
lang en_US.UTF-8 | |
# ネットワーク設定 | |
network --bootproto=dhcp --device=ens3f0 --onboot=off --ipv6=auto | |
network --hostname=localhost.localdomain | |
# chronydをdisableに | |
services --disabled="chronyd" | |
# 生成したrootパスワード (openssl passwd -1で生成) | |
rootpw --iscrypted $6$OIUi2IML9fNhcWBm$O.cXaGPJZQgNjwelX0lgjJs/cLuEcGnImZLPrsk5OlxSSxncNg2LbeLvhuqrU1KTU2uUpVktUj1ZE20mCpuLc0 | |
# タイムゾーン | |
timezone Asia/Tokyo --isUtc --nontp | |
# ブートローダーの設定 | |
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda | |
# パーティションテーブルは全て初期化 | |
clearpart --none --initlabel | |
# パーティションの設定 | |
part /boot --fstype="xfs" --size=500 | |
part /boot/efi --fstype="efi" --size=200 --fsoptions="umask=0077,shortname=winnt" | |
part btrfs.01 --fstype="btrfs" --ondisk=sdb --size=109676 | |
part swap --fstype="swap" --size=4096 | |
btrfs none --label=centos btrfs.01 | |
btrfs / --subvol --name=root LABEL=centos | |
btrfs /home --subvol --name=home LABEL=centos | |
%packages | |
@core | |
kexec-tools | |
%end | |
%addon com_redhat_kdump --enable --reserve-mb='auto' | |
%end |
7.
# darkhttpd /mnt/centos
# systemctl start dnsmasq
これで自動でPXE Bootして,Kickstartでインストールしてくれるはず.
もしKickstartを使わず手動インストーラをぽちぽちするならば,
2.で/mnt/centosにファイルを配置とかじゃなくてisoを直接マウントして,
grub.cfgのカーネルコマンドラインからks=の部分を削除すれば大丈夫です.