about summary refs log tree commit diff stats
path: root/tools/qemu.html
diff options
context:
space:
mode:
authorSilvino Silva <silvino@bk.ru>2016-09-15 00:47:34 +0100
committerSilvino Silva <silvino@bk.ru>2016-09-15 00:47:34 +0100
commit07bedee34d9ded6f86904c7e4b4e02464ff8cb14 (patch)
tree242dcbfdcd97667017bdfcaaa535919b01168fe1 /tools/qemu.html
parentb9762bb44befe4a852688eb19cce1aec3462f2ca (diff)
downloaddoc-07bedee34d9ded6f86904c7e4b4e02464ff8cb14.tar.gz
added tools
Diffstat (limited to 'tools/qemu.html')
-rw-r--r--tools/qemu.html148
1 files changed, 148 insertions, 0 deletions
diff --git a/tools/qemu.html b/tools/qemu.html
new file mode 100644
index 0000000..9110b10
--- /dev/null
+++ b/tools/qemu.html
@@ -0,0 +1,148 @@
+<!DOCTYPE html>
+<html dir="ltr" lang="en">
+    <head>
+        <meta charset='utf-8'>
+        <title>1. Qemu</title>
+    </head>
+    <body>
+
+        <a href="index.html">Tools Index</a>
+
+        <h1>1. Qemu</h1>
+
+        <p>Disk images;</p>
+
+        <dl>
+            <dt>img</dt>
+            <dd>network slirp</dd>
+            <dt>raw</dt>
+            <dd>network tap</dd>
+            <dt>qcow2</dt>
+            <dd>... ...</dd>
+        </dl>
+
+
+        <p>Network configuration;</p>
+        <dl>
+            <dt>slirp</dt>
+            <dd>network slirp</dd>
+            <dt>tun/tap</dt>
+            <dd>network tap</dd>
+            <dt>...</dt>
+            <dd>... ...</dd>
+        </dl>
+
+        <h2>Kernel configuration</h2>
+
+        <pre>
+        # usermod -a -G kvm c9admin
+        # usermod -a -G kvm username
+        </pre>
+
+        <h2>Network configuration</h2>
+
+        <h3>Tap interfaces</h3>
+
+        <pre>
+        KERNEL=="tun", GROUP="kvm", MODE="0660", OPTIONS+="static_node=net/tun"
+        </pre>
+
+        <p>Automatic creation of tap interface with
+        correct permissions set for user and group,
+        you can set only user or group;</p>
+
+        <pre>
+        # tunctl -u username -g kvm
+        </pre>
+
+        <p>Set permissions to existing tap interface;</p>
+
+        <pre>
+        # tunctl -u username -t tap0
+        </pre>
+
+
+        <p>Manual creation of tap interface;</p>
+
+	<pre>
+	# ip tuntap add name tap0 mode tap
+        # chmod 0666 /dev/tap0
+        # chown root:username /dev/tap0
+	# ip link show
+	</pre>
+
+        <p>Start qemu with 512 of ram, mydisk.img as disk and boot from iso</p>
+
+        <pre>
+        $ qemu-system-x86_64 \
+        -enable-kvm \
+        -m 512 \
+        -boot d -cdrom image.iso \
+        -hda mydisk.img
+    	</pre>
+
+        <p>Start qemu with 1024 of ram, network configured using tap0
+        interface device no host and boot from crux.qcow2;</p>
+
+	<pre>
+	$ qemu-system-x86_64 \
+	-enable-kvm \
+	-m 1024 \
+	-hda c9/local/crux.qcow2 \
+	-net nic,model=virtio -net tap,ifname=tap0,script=no,downscript=no
+        </pre>
+
+	<p>On host machine test network;</p>
+
+	<pre>
+	# tcpdump tap0
+	</pre>
+
+        <h2>Disk image files</h2>
+
+        <p>Create hard disk image, there is different types,
+        this describes how to create a qcow2 type;</p>
+
+        <pre>
+        $ qemu-img create -f qcow2 crux-img.qcow2 20G
+        </pre>
+
+        <p>You can mount disk image;</p>
+
+        <pre>
+        $ sudo modprobe nbd
+        $ sudo qemu-nbd -c /dev/nbd0 /crux-img.qcow2
+        </pre>
+
+        <p>To disconnect image disk (ndb);</a>
+
+        <pre>
+        $ sudo qemu-nbd -d /dev/nbd0
+        </pre>
+
+        <p>You can use image as a normal disk, example how
+        to use parted to create a gpt system table;</p>
+
+        <pre>
+        # parted /dev/nbd0
+        (parted) mklabel gpt
+        </pre>
+
+        <p>More information about
+        <a href="http://devil-detail.blogspot.pt/2013/07/install-grub2-on-gpt-disk-dedicated-partition.html">gpt partition table</a>.
+        </p>
+
+        <p>If partitions are on qcow2 image then setup partitions;</p>
+
+        <pre>
+        # kpartx -a -s -l /dev/nbd0
+        </pre>
+
+        <a href="index.html">Tools Index</a>
+        <p>This is part of the c9 Manual.
+        Copyright (C) 2016
+        Silvino Silva.
+        See the file <a href="../fdl-1.3-standalone.html">Gnu Free Documentation License</a>
+        for copying conditions.</p>
+    </body>
+</html>