https://github.com/git719/vm
VirtualBox management utility in Python
https://github.com/git719/vm
macos python ubuntu virtualbox
Last synced: 12 months ago
JSON representation
VirtualBox management utility in Python
- Host: GitHub
- URL: https://github.com/git719/vm
- Owner: git719
- License: mit
- Created: 2022-05-04T19:37:25.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-04T19:38:53.000Z (almost 4 years ago)
- Last Synced: 2025-01-14T10:29:35.923Z (about 1 year ago)
- Topics: macos, python, ubuntu, virtualbox
- Language: Shell
- Homepage:
- Size: 37.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vm
A small command line [VirtualBox](https://www.virtualbox.org/) front-end utility to manage Linux VMs on __macOS__.
It's similar to VirtualBox's own [`VBoxManage`](https://www.virtualbox.org/manual/ch08.html), but limited to only those functions I find myself needing 99% of the time when I'm working with Linux VMs. In addition, it allows the automated provisioning of one or multiple VMs, like a poor-man's Vagrant, albeit a much more destitute one 😀.
- Again, __only__ Linux VMs, and only on __macOS__
- Still a work in progress, so expect to resolve some issues by manually hopping back on the VirtualBox GUI
- This is the __Python__ language version ([a C version sits here](https://github.com/lencap/vmc))
- The original BASH version are also include here for posterity (`vm.sh_orig`, `vm.sh`, and `pacos.sh`)
## Prerequisites
* Virtual machines created and managed by this utility __must__ be based on OVA files created by using repo https://github.com/lencap/osimages. Run `vm imgpack` for more information on how to do that.
* Tested on macOS v10.15.4 with VirtualBox v6.1.6
## Provisioning VMs
The `vm prov` command provisions VMs automatically based on a simple configuration file.
You can create a sample skeleton config file by running `vm prov c`. By default, this file will be named `vm.conf`, which the `vm prov` command will read and follow to provision things accordingly. But you can name the file whatever you wish, so you can then have multiple of these provisioning config files in your repo, which you can then provision as `vm prov myprov1.conf`, and so on.
## Networking Modes
Two networking modes are supported: The default __HostOnly__ mode, or the optional and experimental __Bridged__ mode.
HostOnly networking, as used in most local VM configurations, sets up NIC1 as NAT for external traffic, and NIC2 as HostOnly for intra-VM traffic. This is usually the most popular mode, as it allows one to set up a mini network of VMs for whatever work one is doing.
Bridged networking allows one use the local LAN, with a static IP address for each VM, all running from your own host machine. This option allows others on the same LAN to access services running on your VMs. __IMPORTANT__: For this to work A) you need local host __administrator privileges__, and B) you need to be allowed to assign STATIC IP ADDRESSES on your local network. This mode is not as popular, but can be useful in some unique settings.
## Installation Options
There are two install options:
- `brew install lencap/tools/vm` to use latest Homebrew release, or ...
- `make install` to place `vm` under `/usr/local/bin/`
## Usage
```
$vm
Simple Linux VM Manager v265
vm list List all VMs
vm create <[ovaFile|imgName> Create VM form given ovaFile, or imgName
vm del [f] Delete VM. Force option
vm start [g] Start VM. GUI option
vm stop [f] Stop VM. Force option
vm ssh [] SSH into or optionally run command on VM
vm prov [|c] Provision VMs in given vmConf file; Create skeleton file option
vm info Dump subset of all VM details for common troubleshooting
vm mod [] Modify VM CPUs and memory. Memory defaults to 1024
vm ip Set VM IP address
vm imglist List all available images
vm imgcreate Create imgName from existing VM
vm imgpack How-to create brand new OVA image with Hashicorp packer
vm imgimp Import image. Make available to this program
vm imgdel [f] Delete image. Force option
vm nettype Set NIC type to Bridge as option; default is always HostOnly
vm netlist List available HostOnly networks
vm netadd Create new HostOnly network
vm netdel Delete given HostOnly network
```