forked from josug-book1-materials/ubuntu-virtinst
/
virtinst-stack01.sh
executable file
·51 lines (46 loc) · 1.1 KB
/
virtinst-stack01.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
TOP_DIR=$(cd $(dirname "$0") && pwd)
NAME=stack01
RELEASE_NAME=focal
OS_VARIANT=ubuntu20.04
NUM_CPU=2
MEMORY=8192
ARCH=amd64
VIRT_ARCH=x86_64
SITE=http://ftp.riken.go.jp/Linux/ubuntu
LOCATION=$SITE/dists/$RELEASE_NAME/main/installer-$ARCH/
#LOCATION=/tmp/ubuntu-14.04.1-server-amd64.iso
IMAGEDIR=/var/lib/libvirt/images
DISK1FORMAT=raw
DISK1SIZE=64
DISK1FILE=$IMAGEDIR/$NAME.img
sudo virt-install \
--name $NAME \
--os-type linux \
--os-variant $OS_VARIANT \
--cpu host \
--arch $VIRT_ARCH \
--connect=qemu:///system \
--vcpus $NUM_CPU \
--ram $MEMORY \
--nographics \
--serial pty \
--console pty \
--disk=$DISK1FILE,format=$DISK1FORMAT,size=$DISK1SIZE,sparse=true \
--location $LOCATION \
--network network=openstack,model=virtio \
--network network=openstack,model=virtio \
--initrd-inject $TOP_DIR/stack01/preseed.cfg \
--extra-args "
console=ttyS0,115200
file=/preseed.cfg
auto=true
priority=critical
interface=auto
language=en
country=JP
locale=en_US.UTF-8
console-setup/layoutcode=jp
console-setup/ask_detect=false
DEBCONF_DEBUG=5
"