LoginSignup
1
2

More than 5 years have passed since last update.

VM setup on headless KVM (2)

Last updated at Posted at 2018-05-01

目標:GUI が使えない手元 KVM に ubuntu 仮想マシンをセットアップしたい。X を飛ばすとかは無しで。

前回よりも、もっと手っ取り早い方法を見つけたような気がする。

92.cfg というファイルを用意して 90_dpkg.cfg の中身を上書きする。

92.cfg
#cloud-config
datasource_list: [ None ]
ssh_pwauth: True
password: password
lock_passwd: False

virt-sysprep で潜り込ませる。書き換える前の test.img は前回同様 ubuntu-cloud のイメージをコピーしておく。

virt-sysprep --copy-in $PWD/92.cfg:/etc/cloud/cloud.cfg.d/ \
  -a /var/lib/libvirt/images/test.img

libvirt に登録し、インストールを行う。

virt-install --virt-type kvm --name test --ram 2048 \
  --disk path=/var/lib/libvirt/images/test.img,size=16 \
  --graphics none --console pty,target_type=serial --import --network network=default

ログインし、cloud-init を無効化する

sudo touch /etc/cloud/cloud-init.disabled
1
2
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
1
2