SST Lab Dokuwiki Header header picture

ユーザ用ツール

サイト用ツール


linux:kvm_info

Kernel-based Virtual Machine

仮想マシンの削除

$ virsh list --all
 Id   Name       State
---------------------------
 5    ssp0       running
 -    template   shut off
 
$ virsh undefine template
Domain template has been undefined
 
$ virsh list --all
 Id   Name   State
----------------------
 5    ssp0   running
 
$

仮想マシンの設定変更

$ virsh list --all
 Id   Name   State
-----------------------
 -    ssp0   shut off
 
$ virsh edit ssp0
.
.
.          
Domain ssp0 XML configuration edited.
 
$ virsh start ssp0
Domain ssp0 started

仮想マシンのクローン化

$ 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
/etc/netplan/01-fix-ipv4-config.yaml
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
linux/kvm_info.txt · 最終更新: 2021/03/02 13:24 by kimi