https://github.com/git719/vmc
VirtualBox management utility in C
https://github.com/git719/vmc
c macos ubuntu virtualbox
Last synced: 12 months ago
JSON representation
VirtualBox management utility in C
- Host: GitHub
- URL: https://github.com/git719/vmc
- Owner: git719
- License: mit
- Created: 2022-05-04T20:06:16.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-04T20:10:14.000Z (almost 4 years ago)
- Last Synced: 2025-01-14T10:29:37.752Z (about 1 year ago)
- Topics: c, macos, ubuntu, virtualbox
- Language: C++
- Homepage:
- Size: 1.81 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# VMC
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 😀.
Things to keep in mind:
- 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 __C__ language version ([a Python version sits here](https://github.com/lencap/vm))
- The prime driver with functionality and code is the KISS principle
- Constructive comments and suggestions are always welcome
## VirtualBox SDK
This repo contains a subset of the [VirtualBox SDK code](https://www.virtualbox.org/wiki/Downloads) under `./bindings/`. It is needed to compile against the VBOX C API, and the code is licensed as per the vendor.
To copy the pertinent SDK files, at any time, run the `./getbindings` script from the root of a checked-out copy of this repo.
## 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 `vmc imgpack` for more information on how to do that.
* Tested on macOS v10.15.4 with VirtualBox v6.1.6
## Provisioning VMs
The `vmc prov` command provisions VMs automatically based on a simple configuration file.
You can create a sample skeleton config file by running `vmc prov c`. By default, this file will be named `vmc.conf`, which the `vmc 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 `vmc 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/vmc` to use latest Homebrew release, or ...
- `make`, then `make install` to place binary under `/usr/local/bin/`, if you're good compiling this yourself
## General Usage
```
$ vmc
Simple Linux VM Manager v117
vmc list List all VMs
vmc create Create VM from given ovaFile, or imgName
vmc del [f] Delete VM. Force option
vmc start [g] Start VM. GUI option
vmc stop [f] Stop VM. Force option
vmc ssh [] SSH into or optionally run command on VM
vmc prov [|c] Provision VMs in given vmConf file; Create skeleton file option
vmc info Dump subset of all VM details for common troubleshooting
vmc mod [] Modify VM CPUs and memory. Memory defaults to 1024
vmc ip Set VM IP address
vmc imglist List all available images
vmc imgcreate Create imgName from existing VM
vmc imgpack How-to create brand new OVA image with Hashicorp packer
vmc imgimp Import image. Make available to this program
vmc imgdel [f] Delete image. Force option
vmc nettype Set NIC type to Bridge as option; default is always HostOnly
vmc netlist List available HostOnly networks
vmc netadd Create new HostOnly network
vmc netdel Delete given HostOnly network
```