Skip to content

OpenRC init script for QEMU/KVM (for Gentoo and Alpine Linux)

License

Notifications You must be signed in to change notification settings

jirutka/qemu-openrc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenRC runscript for QEMU

This is (opinionated) OpenRC runscript for QEMU virtual machines.

You don’t need libvirt and its awful XML configs to use QEMU/KVM!

Requirements

  • OpenRC

  • Bash or Busybox’s ash (should work also with other POSIX shells)

  • socat

  • Linux kernel with virtio drivers

    CONFIG_HW_RANDOM_VIRTIO=y
    CONFIG_SCSI_VIRTIO=y
    CONFIG_VIRTIO=y
    CONFIG_VIRTIO_BALLOON=y
    CONFIG_VIRTIO_NET=y
    CONFIG_VIRTIO_PCI=y

Installation

Alpine Linux

Install package qemu-openrc:

apk add qemu-openrc

Manually

  1. Install socat:

    emerge -av net-misc/socat  # on Gentoo
    apk add socat  # on Alpine
  2. Clone this repository and jump in:

    git clone https://github.com/jirutka/qemu-openrc.git
    cd qemu-openrc
  3. Install runscript, example config and qemush utility:

    make install

    You may use standard GNU variables such as DESTDIR, prefix, bindir… to specify the target directories.

How to configure a new VM

  1. Symlink runscript qemu for your new VM named jarvis:

    cd /etc/init.d
    ln -s qemu qemu.jarvis
  2. Configure your new VM:

    cd /etc/conf.d
    cp qemu qemu.jarvis
    vim qemu.jarvis
  3. Start your new VM:

    rc-service qemu.jarvis start

License

This project is licensed under MIT License.