====== Kernel-based Virtual Machine ======
===== 仮想マシンのクローン化 =====
$ virt-clone --original template --name sstxp --file images/sstxp.qcow2
ubuntu@template:~$ hostnamectl
Static hostname: template
Icon name: computer-vm
Chassis: vm
Machine ID: d7a1d3b5bea6410bae792841027c0735
Boot ID: ee7f7c9a95f84c6393387267791fffaf
Virtualization: kvm
Operating System: Ubuntu 20.04.2 LTS
Kernel: Linux 5.4.0-66-generic
Architecture: x86-64
ubuntu@template:~$ hostnamectl set-hostname sstxp
==== AUTHENTICATING FOR org.freedesktop.hostname1.set-static-hostname ===
Authentication is required to set the statically configured local host name, as well as the pretty host name.
Authenticating as: Ubuntu (ubuntu)
Password:
==== AUTHENTICATION COMPLETE ===
ubuntu@template:~$ hostnamectl
Static hostname: sstxp
Icon name: computer-vm
Chassis: vm
Machine ID: d7a1d3b5bea6410bae792841027c0735
Boot ID: ee7f7c9a95f84c6393387267791fffaf
Virtualization: kvm
Operating System: Ubuntu 20.04.2 LTS
Kernel: Linux 5.4.0-66-generic
Architecture: x86-64
ubuntu@template:~$
$ sudo mv /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.disabled
network:
ethernets:
enp1s0:
addresses: [192.168.10.204/24]
gateway4: 192.168.10.254
nameservers:
addresses: [192.168.10.1]
search: [ee.ous.ac.jp]
version: 2
$ sudo hostnamectl set-hostname ((hostname))
$ sudo cat > 01-fix-ipv4-config.yaml << EOF
network:
ethernets:
enp1s0:
addresses: [192.168.10.((ip address))/24]
gateway4: 192.168.10.254
nameservers:
addresses: [192.168.10.1]
search: [ee.ous.ac.jp]
version: 2
EOF
$ sudo cp 01-fix-ipv4-config.yaml /etc/netplan/
$ sudo mv /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.disabled