Manage KVM Virtual Machines using CLI Virsh

Description: virsh is a program which uses libvirt to manage KVM virtual machines (guests). I’m going to show a summary of its main functions (cheat sheet style):

Show guests’ information:

  • Show a list of all the defined guests: virsh list --all
  • Show a guest’s info: virsh dominfo guest's_name

Start and stop guests:

  • Start a guest: virsh start guest's_name
  • Shutdown a guest (gently): virsh shutdown guest's_name
  • Shutdown a guest (wild): virsh destroy guest's_name
  • Suspend a guest: virsh suspend guest's_name
  • Resume a suspended guest: virsh resume guest's_name

Create and modify guests:

  • Create a new guest
  • Create a guest from its XML definition: virsh create xml_file.xml
  • Dump a guest’s definition in XML: virsh dumpxml guest's_name
  • Modify a guest’s definition: virsh edit guest's_name
  • Remove a guest’s definition (it doesn’t remove the image file): virsh undefine guest's_name

Backup and restore guests:

  • Save a guest’s state on a file: virsh save guest's_name guest's_state_file
  • Restore a guest from a state file: virsh restore guest's_state_file

Source: https://acidborg.wordpress.com/2010/02/19/how-to-manage-kvm-virtual-machines-using-virsh/

Freya Linux ISO

64-bit

magnet:?xt=urn:btih:fc85dc999730a42de3924444aadbcfa183b5f388&dn=elementaryos-freya-amd64.20150411.iso&tr=https%3A%2F%2Fashrise.com%3A443%2Fphoenix%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.ccc.de%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80%2Fannounce

 

32-bit

magnet:?xt=urn:btih:0a36a61cb46fc1444c95eb62185b777d65362ca9&dn=elementaryos-freya-i386.20150411.iso&tr=https%3A%2F%2Fashrise.com%3A443%2Fphoenix%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.ccc.de%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80%2Fannounce

Debian Setting Up Docker Private Registry

$ sudo apt-get update
$ sudo apt-get install docker.io

$docker pull registry

$docker run –p 5000:5000 –d --name=private_registry registry

Once you have created the private registry, you need to connect it to it from client:

docker login YOUR_IP:5000

# Pull the debian image from the public registry

docker pull debian

# Tag it with our IP/URL

docker tag debian YOUR_IP:5000/debian

# Push it to our newly made registry

docker push YOUR_IP:5000/debian