How to KVM, QEMU start or stop virtual machine from command line (CLI)

Dịch vụ Hosting Vps giá rẻ

VPS Việt Nam giá rẻ, cấu hình mạnh, ổn định. Được đặt tại Datacenter FPT. Giá chỉ từ 50k cùng nhiều phần quà hấp dẫn Nâng cấp dễ dàng, không tốn thêm phí Cam kết hoàn tiền ngay nếu không hài lòng . Đăng Ký : vps giá rẻ Ngay.
Follow Me

KVM or Kernel Based Virtual Machine is a popular virtualization technology. It allows you to run virtual guest machines over a host machine.
To start or stop virtual machines created on head-less servers you have to use the CLI or command line interface. There are more than one option, but we will see just one.
We will use virsh, which is based on libvirt.

A toolkit to interact with the virtualization capabilities of recent versions of Linux (and other OSes), see our project goals for details.

First check which virtual machines are available:

virsh list --all

In my case the output is:

 Id    Name                           State
 -     ubuntu-desktop                 shut off
 -     ubuntu-server                  shut off

I will start the ubuntu-server virtual machine:

virsh start ubuntu-server

The output is:

Domain ubuntu-server started

To shut it down, just enter.

virsh shutdown ubuntu-server


If you enjoyed the article, please share it