lost and found ( for me ? )

KVM : install CentOS 6.9 VM with zero touch by using kickstart

KVM host
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"

$ kvm --version
QEMU emulator version 2.5.0 (Debian 1:2.5+dfsg-5ubuntu10.11), Copyright (c) 2003-2008 Fabrice Bellard

Here is a sample kickstart file for CentOS 6.9.
$ cat cent6.ks
# Kickstart file automatically generated by anaconda.

#version=DEVEL
install
cdrom
lang ja_JP.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --noipv6
rootpw --plaintext password

firewall --disabled
authconfig --enableshadow --passalgo=sha512
selinux --disabled
timezone --utc Asia/Tokyo
bootloader --location=mbr --driveorder=vda --append="console=ttyS0,115200n8 crashkernel=auto console=ttyS0,115200n8"
# Clear the Master Boot Record
zerombr
# 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 --initlabel


part / --fstype=ext4 --grow --asprimary --size=1

#repo --name="CentOS"  --baseurl=cdrom:sr0 --cost=100

%packages --nobase
@Core
@core

%end

build a VM.
$ sudo virt-install  -n cent6-01 --memory 2048 -f /var/lib/libvirt/images/cent6-01.qcow2,size=20,format=qcow2,bus=virtio,cache=none --vcpus=1 --os-type linux --os-variant centos6.0 --location /home/hattori/ISO_images/CentOS-6.9-x86_64-minimal.iso --extra-args='ks=file:/cent6.ks console=tty0 console=ttyS0,115200n8' --keymap ja --initrd-inject ./cent6.ks --network=default,model=virtio --noautoconsole

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.