Skip to content

Commit

Permalink
Adding docs, moving installation to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zwoefler committed Sep 4, 2024
1 parent 8237fa1 commit 33929b7
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 30 deletions.
40 changes: 10 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- Quickly create and SSH into throwaway VMs.
- Fast boot times using minimal cloud images.
- On-demand downloads for `Debian`, `Ubuntu`, `Arch`, `Fedora`, `CentOS`, `Rocky` and `Alma` cloud images.
- Customizable cloud-init commands.
- Shell completion
- Utilizes `KVM`, `QEMU`, and `libvirt`.

## 🤔 Why?
Expand All @@ -28,7 +28,8 @@ Especially useful when Containers do not suffice.
RUN:
```BASH
vmchamp run mytestvm
# or vmchamp run mytestvm --os debian11 --mem 256MB --disk 4GB
# or for more options
vmchamp run mytestvm --os debian11 --mem 256MB --disk 4GB
```

Which leads to output:
Expand Down Expand Up @@ -61,48 +62,27 @@ source <(vmchamp --completion zsh)
## 🛠️ Installation
TESTED on: `Ubuntu 22.04`; `Debian 12`

**🔧 Prerequisites**:
- Linux machine support `virtualization with KVM`
- `KVM`, `QEMU` and `libvirt` installed
- Ensure a default network interface is defined in libvirt, typically named "default."
For details see [Installation Guide](/docs/Install.md)

Check if your cpu supports virtualization:
```BASH
grep -Ec '(vmc|svm)' /proc/cpuinfo
# If the output is greater than 0 your CPU supports hardware virtualization.
```
**🔧 Prerequisites**:
- Your machine supports `virtualization with KVM`

```BASH
# 1. First, ensure your system is up to date and install the required dependencies:
# Installing requirements
sudo apt update
sudo apt install qemu-kvm libvirt-daemon-system

# 2. Download latest VmChamp:
# Download latest VmChamp:
wget -qO- https://api.github.com/repos/zwoefler/VmChamp/releases/latest | grep "browser_download_url" | cut -d '"' -f 4 | wget -i - -O vmchamp

# 3. Install VmChamp
# Make the file executable:
# Install VmChamp rootless
chmod +x vmchamp

# Move vmchamp to your PATH:
# Move to /usr/local/bin that's in your PATH.
# Or rootless install ~/.local/bin:
mkdir -p ~/.local/bin
mv vmchamp ~/.local/bin/

# Ensure ~/.local/bin is in your PATH by adding the following to your ~/.bashrc or ~/.zshrc:
export PATH="$PATH:$HOME/.local/bin"

vmchamp # Displays help message
```

**ISSUES WITH INSTALLATION:**
If your default interface is not started (https://github.com/wubbl0rz/VmChamp/issues/3) try:

```BASH
# use sudo if your user is not in the libvirt group
virsh --connect qemu:///system net-start --network default
virsh --connect qemu:///system net-autostart default
vmchamp run testvm
```

## 🏗️ Build
Expand Down
25 changes: 25 additions & 0 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Frequently Asked Questions


### How to fix `libvirt: Domain error : invalid domain pointer in virDomainDestroy`?
The `qemu-bridge-helper` must run with elevated privileges.
To avoid using sudo, set the `setuid bit` on the file:

```BASH
sudo chmod u+s /usr/lib/qemu/qemu-bridge-helper
```

**Explanation**:
Setting the `setuid bit` on an executable runs the file with the permissions of the owner (root), rather than the user (you) who runs the executable.
The `qemu-bridge-helper` must run with elevated privileges to configure network interfaces.
This sets up a network bridge that connects the virtual machines to the physical network.

### Where are the downloaded VM-Images stored?
```BASH
~/VmChamp/default/cache/
```

On first run, the folder `~/VmChamp/default` is created.

### How does VmChamp create the SSH connection?
On creation of the VM **every** `.pub` key inside your `~/.ssh` directory is added to the `authorized_keys` file in the VM.
54 changes: 54 additions & 0 deletions docs/Install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 🛠️ Install
TESTED on: `Ubuntu 22.04`; `Debian 12`

### 🔧 Prerequisites:
- Linux machine support `virtualization with KVM`
- `KVM`, `QEMU` and `libvirt` installed
- Ensure a default network interface is defined in libvirt, typically named "default."


### 🚀 INSTALLATION:
1. Check if your cpu supports virtualization:
```BASH
grep -Ec '(vmc|svm)' /proc/cpuinfo
# If the output is greater than 0 your CPU supports hardware virtualization.
```

2. First, ensure your system is up to date and install the required dependencies:
```BASH
sudo apt update
sudo apt install qemu-kvm libvirt-daemon-system
```

3. Download latest VmChamp:
```BASH
wget -qO- https://api.github.com/repos/zwoefler/VmChamp/releases/latest | grep "browser_download_url" | cut -d '"' -f 4 | wget -i - -O vmchamp
```
4. Install VmChamp
```BASH
# Make the file executable:
chmod +x vmchamp

# Move vmchamp to your PATH:
# Move to /usr/local/bin that's in your PATH.
# Or rootless install ~/.local/bin:
mkdir -p ~/.local/bin
mv vmchamp ~/.local/bin/

# Ensure ~/.local/bin is in your PATH by adding the following to your ~/.bashrc or ~/.zshrc:
export PATH="$PATH:$HOME/.local/bin"
```

5. Run VmChamp
```BASH
vmchamp # Displays help message
```

### ISSUES WITH INSTALLATION:
If your default interface is not started (https://github.com/wubbl0rz/VmChamp/issues/3) try:

```BASH
# use sudo if your user is not in the libvirt group
virsh --connect qemu:///system net-start --network default
virsh --connect qemu:///system net-autostart default
```
13 changes: 13 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# VmChamp Documentation

Simple and fast creation of throwaway VMs on your local machine. Connect via SSH seconds.

VmChamp allows users to quickly create virtual machines using a command-line interface.
It supports various Linux distributions and utilizes `KVM` (Kernel-based Virtual Machine) for virtualization.

## How It Works

- **VM Creation:** Users initiate VMs and can customize the settings (OS, Memory, CPUs, etc.).
- **Storage:** All VMs are stored at `~/VmChamp`, which is created upon first using the tool.


0 comments on commit 33929b7

Please sign in to comment.