Libvirt is an open source virtualization API that provides a consistent interface enabling you to provision, start, stop, migrate, and monitor VMs on KVM hypervisor.
This tutorial is pulled directly from Mastering KVM Virtualization – The Ultimate eBook. Want more practical KVM insights? Grab the full guide.
The management of the libvirtd
service can vary slightly depending on the host operating system – whether it uses systemd
or the older init systems like SysVinit
or Upstart
.
Here’s we show you how the management of the libvirtd
service can be performed on different init systems. The list should cover the common Libvirtd service management operations you might need to perform on various systems.
1. Systemd
Enable libvirtd
service to start on system boot:
sudo systemctl enable libvirtd
Start the libvirtd
service:
sudo systemctl start libvirtd
Check the libvirtd
service status:
sudo systemctl status libvirtd
Stop the libvirtd
service:
sudo systemctl stop libvirtd
Restart the libvirtd
service:
sudo systemctl restart libvirtd
Reload the libvirtd
service configuration without stopping it:
sudo systemctl reload libvirtd
Disable the libvirtd
service so it does not start on boot:
sudo systemctl disable libvirtd
2. SysVinit
Enable the libvirtd
service to start on boot:
sudo chkconfig libvirtd on
Start the libvirtd
service:
sudo service libvirtd start
Check the status of the libvirtd
service:
sudo service libvirtd status
Stop the libvirtd
service:
sudo service libvirtd stop
Restart the libvirtd
service:
sudo service libvirtd restart
Reload the libvirtd
service configuration without stopping it:
sudo service libvirtd reload
Disable the libvirtd
service so it does not start on boot:
sudo chkconfig libvirtd off
3. Upstart
Upstart is primarily used in older versions of Ubuntu (from 9.10 to 14.10) and some other distributions.
Start the libvirtd
service:
sudo start libvirtd
Check the status of the libvirtd
service:
sudo status libvirtd
Stop the libvirtd
service:
sudo stop libvirtd
Restart the libvirtd
service:
sudo restart libvirtd
Reload the libvirtd
service configuration without stopping it:
sudo reload libvirtd
Summary of Commands
Action | Systemd | SysVinit | Upstart |
---|---|---|---|
Enable service | systemctl enable libvirtd | chkconfig libvirtd on | N/A |
Start service | systemctl start libvirtd | service libvirtd start | start libvirtd |
Check status | systemctl status libvirtd | service libvirtd status | status libvirtd |
Stop service | systemctl stop libvirtd | service libvirtd stop | stop libvirtd |
Restart service | systemctl restart libvirtd | service libvirtd restart | restart libvirtd |
Reload service | systemctl reload libvirtd | service libvirtd reload | reload libvirtd |
Disable service | systemctl disable libvirtd | chkconfig libvirtd off | N/A |