GithubHelp home page GithubHelp logo

qemu_vm's Introduction

qemu_vm

Small QEMU Virtual Machine Management Tool

Usage

create new vm image from iso file

./vm.py create_from_iso mydebian 16 debian-10.13.0-amd64-xfce-CD-1.iso

Will create a 16 GB disk file and start a new qemu vm for os installation with debian-10.13.0-amd64-xfce-CD-1.iso image

create new vm image from predefined distribution (debian or ubuntu)

./vm.py create mydebian 16 debian

Will create a 16 GB disk file, download the predefined debian iso file and start a new qemu vm for os installation.

start vm (need an installed qemu image)

./vm.py start dg-vm-debian10.13.qcow  --daemonize --ssh_port 9134

Will start a new vm from dg-vm-debian10.13.qcow image in the background and expose ssh port 9134.

configurre a new vm (eg debian-10.13)

If no ssh server is installed on the vm (default), you should start the vm in graphical mode.

  ./vm.py start dg-vm-debian10.13.qcow --graphical

set the user as root

  usermod -aG sudo {USER}

install ssh server on vm (eg ubuntu-10.04)

install openssh-server

sudo apt install openssh-server

Then, you can restart the machine on non-graphical mode (default), and connect through ssh.

./vm.py start dg-vm-debian10.13.qcow  --daemonize --ssh_port 9134
ssh {USER}@localhost -p 9134

start the vm with an additional disk

as example, to create a new disk of 32 GB

qemu-img create -f qcow2 mydisk.qcow2 32G

start the machine with the new disk attached

./vm.py start dg-vm-debian10.13.qcow  --daemonize --ssh_port 9134 --disk mydisk.qcow2
ssh {USER}@localhost -p 9134

Normally, the new disk is visible in /dev/vdb, you can check that your disk is visible with

fdisk -l

the first time, you need to create create a new partition on the new disk (eg ext4)

sudo mkfs -t ext4 /dev/vdb

then, you can mount it manually on specific directory (eg : /data) :

sudo mkdir /data && sudo chown {USER}:{GOUP} /data
sudo mount /dev/vdb /data

or configure the fstab as below for a permanent mounting point :

sudo echo "/dev/vdb /data ext4 rw,user,auto,exec 0 0" >>  /etc/fstab

Apendix

update debian10 packages list (buster)

add this to /etc/apt/sources.list

deb-src http://deb.debian.org/debian/ buster main

deb http://security.debian.org/debian-security buster/updates main
deb-src http://security.debian.org/debian-security buster/updates main

# buster-updates, previously known as 'volatile'
deb http://deb.debian.org/debian/ buster-updates main
deb-src http://deb.debian.org/debian/ buster-updates main

deb-src http://deb.debian.org/debian/ sid main contrib non-free

disable password for USER

sudo visudo

add thoses lines :

{USER}  ALL=(ALL) NOPASSWD:ALL

qemu_vm's People

Contributors

dgerinmem avatar dgerin 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.