{"id":23591447,"url":"https://github.com/dvob/vu","last_synced_at":"2025-05-07T17:20:18.085Z","repository":{"id":57558727,"uuid":"191396003","full_name":"dvob/vu","owner":"dvob","description":"Spin up virtual machines quickly","archived":false,"fork":false,"pushed_at":"2023-02-04T13:13:47.000Z","size":213,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T21:45:12.543Z","etag":null,"topics":["cloud-init","golang","libvirt","ssh","virtualmachine","vm"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dvob.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-11T15:06:47.000Z","updated_at":"2024-11-11T13:01:05.000Z","dependencies_parsed_at":"2023-02-18T16:35:32.934Z","dependency_job_id":null,"html_url":"https://github.com/dvob/vu","commit_stats":null,"previous_names":["dsbrng25b/vu","dsbrng25b/cis"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvob%2Fvu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvob%2Fvu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvob%2Fvu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvob%2Fvu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dvob","download_url":"https://codeload.github.com/dvob/vu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252922308,"owners_count":21825641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud-init","golang","libvirt","ssh","virtualmachine","vm"],"created_at":"2024-12-27T07:39:04.393Z","updated_at":"2025-05-07T17:20:18.063Z","avatar_url":"https://github.com/dvob.png","language":"Go","readme":"# vu\n`vu` (**v**irtual machin **u**p) is a CLI tool which lets you spin up virtual machines quickly. Its goal is to spin up a new VM and connect to it via SSH without going through a cumbersome install wizard and without maintaining special VM images which support automatic installation ourselves.\nTo achieve this `vu` relies on VM images which contain [cloud-init](https://cloudinit.readthedocs.io/en/latest/). Cloud-init runs during the first boot, reads the configuration from a datasource and then configures the VM accordingly (user, network, etc.).\nThe datasource is usually provided by a cloud provider. To use the cloud-init images locally we make use of the [NoCloud](https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html) datasource where we provide the configuration as an attached CDROM.\n\n`vu` usually does the following steps to start a VM:\n* Create a cloud-init config (user data, metadata, network configuration) based on the local user (username, ssh key)\n* Create an ISO image with the cloud-init config in it\n* Clone an image for the new VM from a base image (see https://libvirt.org/kbase/backing_chains.html)\n* Start a VM with cloned image and the the ISO image attached as CDROM\n\n## Quick start\n* Install libvirtd\n```\n# on Ubuntu\nsudo apt install libvirt-daemon-system\nsudo adduser $USER libvirt\n```\n\n* Install `vu` under `~/bin`\n```\ncurl -L -o ~/bin/vu https://github.com/dvob/vu/releases/download/v0.0.4/vu_linux_amd64 \u0026\u0026 chmod +x ~/bin/vu\n```\n\n* Run a VM\n```bash\n# get  a base image\nvu image add https://cloud-images.ubuntu.com/minimal/daily/focal/current/focal-minimal-cloudimg-amd64.img\n\n# create and start a new VM\nvu create focal-minimal-cloudimg-amd64.img mytest1\n\n# list the VMs\nvu list\n```\n\nTo connect to the VM it is recommended to install the [Libvirt NSS module](https://libvirt.org/nss.html) and configure it accordingly:\n```\n# on Ubuntu\nsudo apt-get install libnss-libvirt\n```\n\n`/etc/nsswitch.conf`:\n```\n# ...\nhosts:    files libvirt dns\n# ...\n```\n\nThen you can simply connect to server like this:\n```\nssh mytest1\n```\n\nIf you don't want to use the Libvirt NSS module or you specified a static IP on create with `--ip` then you have to use the IP to connect to the VM.\n\n## Images\nTo find base images you can search for `cloud init images` and then look out for images in the `qcow2` format. Usually they have the `.img` or `.qcow2` file ending. The following link provides a good overview on where you can find cloud-init images: https://docs.openstack.org/image-guide/obtain-images.html\n\nIf you have found an appropriate image you can download it (add it to the base images) with `vu image add`. I tested `vu` with the following images:\n```shell\n# add ubuntu image\nvu image add https://cloud-images.ubuntu.com/daily/server/bionic/current/bionic-server-cloudimg-amd64.img\nvu image add https://cloud-images.ubuntu.com/minimal/daily/focal/current/focal-minimal-cloudimg-amd64.img\n\n# rocky linux image\nvu image add https://download.rockylinux.org/pub/rocky/8.5/images/Rocky-8-GenericCloud-8.5-20211114.2.x86_64.qcow2\n\n# with rocky 8.6 the image does not contain sudo and you have to enhance the base configuration as follows\nmkdir -p ~/.vu/sudo\ncat \u003c\u003cEOF \u003e ~/.vu/sudo/user-data\n{\n  \"packages\": [\"sudo\"]\n}\nEOF\nvu create --dir ~/.vu/sudo Rocky-8-GenericCloud-8.6-20220515.x86_64.qcow2 rocky\n\n# add centos image\nvu image add https://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.3.2011-20201204.2.x86_64.qcow2\n\n# add debian image\nvu image add http://cdimage.debian.org/cdimage/openstack/current/debian-10-openstack-amd64.qcow2\n```\n\n### Storage location\n`vu` uses three [storage pools](https://libvirt.org/storage.html) to store the images:\n* `base` for base images\n* `vm` for vm instances\n* `config` for config ISOs (cidata for cloudinit)\n\nIf these storage pools do not yet exist `vu` creates them on the fly as [directory pool](https://libvirt.org/storage.html#StorageBackendDir) under `/var/lib/libvirt/images/vu/{base,config,vm}`.\n\n## Shell completion\n```\nsource \u003c( vu completion bash )\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvob%2Fvu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdvob%2Fvu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvob%2Fvu/lists"}