GithubHelp home page GithubHelp logo

bash-my-kvm's Introduction

bash-my-kvm

Create various flavours of linux VMs in no time.

Currently only one command: kvm-guest-create

  • Takes ~35 seconds from running script till SSH being available
  • Amazon Linux 2, Fedora, Rocky Linux
  • Guests findable by name from host and each other with zero config
  • On first boot: - runs system update - installs tailscale

TODO

  • bash completion on available distros
  • fix ssh between guests (Add Tailscale domain to /etc/resolv.conf)

Usage

GUEST_NAME=grafana

export LIBVIRT_IMAGES_DIR=~/.libvirt/images # optional for non-root usage

sudo bin/kvm-guest-create "${GUEST_NAME}-amazon" amazon

Install Deps (fedora-36)

sudo yum install -y                \
      genisoimage                  \
      guestfs-tools                \
      libvirt                      \
      libvirt-client               \
      libvirt-dbus                 \
      policycoreutils-python-utils \
      qemu-kvm                     \
      virt-install                 \
      virt-manager                 \
      virt-viewer                  \

sudo systemctl enable --now libvirtd.service # required?

Configure

Configure SSH key / password in config/user-data.

Optionally update the default username / password / SSH public key.

Make guests addressable by name from host by name

Make guests addressable from host by name:

sudo yum install -y libvirt-nss ## RHEL/CentOS/Fedora ##
sudo apt install libnss-libvirt ## Debian/Ubuntu ##

Add libvirt libvirt_guest to hosts entry of nsswitch:

$ grep hosts /etc/nsswitch.conf
hosts:       files libvirt libvirt_guest dns

Create your kvm guest

bin/kvm-guest-create GUEST_NAME [GUEST_TYPE] # amzn2, fedora, rocky, etc

Working with your guests

Connect to guest console:

virsh console $GUEST_NAME

SSH to it's IP address (accessible by name from host or other guests):

ssh admin@$GUEST_NAME

bash-my-kvm's People

Contributors

mbailey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.