Host machine setting
$ sudo apt-get install -y qemu qemu-kvm libvirt-daemon bridge-utils virt-manager virtinst libguestfs-tools nmap
$ virsh net-list --all
# start default network
$ virsh net-start default
$ virsh net-list
You can check the bridge network on hostmachine like 'virbr0'.
Install guest VM with OS: ubuntu 18.04
Install OS on guest VM with ubuntu 18.04, 2 vCPUs, 4GB RAM, 30GB disk in CLI environment using ISO os image.
$ virt-install --name vm-1 --ram 4096 --vcpus 2 --disk ~/vm-1.img,size=30 --os-type linux --os-variant ubuntu18.04 --network bridge=virbr0 --graphics none --console pty,target_type=serial --location ~/ubuntu-18.04.3-server-amd64.iso --extra-args 'console=ttyS0,115200n8 serial'
Open-ssh server must be installed during the process.
Connect VM via console
You can check the VM's IP through this command.
$ sudo nmap -sP [virbr0 CIDR] (192.168.0.0/24)
$ ssh user@VMIP
$ sudo systemctl enable serial-getty@ttyS0.service && sudo systemctl start serial-getty@ttyS0.service
$ virsh list --all
$ virsh connect vm-1
'System Engineering > Linux' 카테고리의 다른 글
bash] system check (0) | 2022.03.28 |
---|---|
Nginx: How to purge the proxy cache (0) | 2020.05.25 |
Ubuntu apt-get upgrade (0) | 2019.12.13 |
Logstash - filebeat SSL settings (0) | 2019.11.26 |
Buffers and cache in memory (Linux) (0) | 2019.11.11 |