LoginSignup
3
7

More than 5 years have passed since last update.

RHEL 7でkickstart

Last updated at Posted at 2016-05-04

VirtualboxにRHEL 7を自動インストールする為にkickstartを使ってみました。
yumによるインストールの例でDockerを入れています。
YOUR_USERNAMECLEAR_TEXT_PASSWORDは自分のRed Hatのサブスクリプションに合わせて修正して下さい。

このファイルをhttpでアクセス出来る場所に置いてRHELのCD ROMを入れて立ち上げた起動画面でTABキーを押し、最後にks=http://192.168.0.5:8000/anaconda-ks.cfgのように定義ファイルを指定します。
kickstart.jpg

anaconda-ks.cfg
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
repo --name="Server-HighAvailability" --baseurl=file:///run/install/repo/addons/HighAvailability
repo --name="Server-ResilientStorage" --baseurl=file:///run/install/repo/addons/ResilientStorage
# Use CDROM installation media
cdrom
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=jp --xlayouts='jp'
# System language
lang ja_JP.UTF-8

# Network information
network  --bootproto=dhcp --device=enp0s3 --ipv6=auto --activate
network  --hostname=rhel7

# Root password is PASSWORD
rootpw --iscrypted $6$37a5ec68c43d0522$8lqJNDajgg362q9pBFWWWztFLELotDEbwTaRjX3Zvz37Hq/2VViawgl0IZxSFTQdJ9y7sUUY8cXjt.ZBS834m/
# System timezone
timezone Asia/Tokyo --isUtc
# password is PASSWORD
user --groups=wheel --name=rhel7 --password=$6$a58429ffe28bf988$aB52XqWFRhmXf2LGkDFVujcgZjGZr44cuGoCv1OEF2Ou2Iw7R7E7Ip8FDNRmQxjNS.cBCh/uSDB1pJl1kzu9T/ --iscrypted --gecos="Red Hat"
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
autopart --type=lvm
# Partition clearing information
clearpart --all --initlabel --drives=sda

%packages
@^minimal
@core
kexec-tools

%end

%post --log=/root/registration_results.out
subscription-manager register --auto-attach --username=YOUR_USERNAME --password=CLEAR_TEXT_PASSWORD

subscription-manager repos --enable=rhel-7-server-extras-rpms
subscription-manager repos --enable=rhel-7-server-optional-rpms
# Docker
yum install -y docker docker-registry
yum install -y device-mapper-libs device-mapper-event-libs
systemctl start docker.service
systemctl enable docker.service

%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end

# Reboot after installation
reboot --eject

ハッシュされたパスワードの設定

  • Macの場合
    php -r 'echo crypt("PASSWORD","$6$".sha1(uniqid(mt_rand(),true))), PHP_EOL;'

  • RHELの場合
    python -c 'import crypt, random, hashlib; random.seed(); print crypt.crypt("PASSWORD", "$6$" + hashlib.sha1(str(random.random())).hexdigest())';

  • RHEL7の場合、こっちの方が簡単でした
    grub2-mkpasswd-pbkdf2

参考

3
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
7