# Proposal to install on qemu

**URL:** <https://forums.suse.com/t/proposal-to-install-on-qemu/1236>\
**Category:** RancherOS\
**Created:** [December 14, 2015, 11:52am UTC](https://forums.suse.com/t/proposal-to-install-on-qemu/1236 "2015-12-14T11:52:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![docteurklein](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/docteurklein/32/655_2.png) [@docteurklein](https://forums.suse.com/u/docteurklein)\
**Post date:** [December 14, 2015, 11:52am UTC](https://forums.suse.com/t/proposal-to-install-on-qemu/1236/1 "2015-12-14T11:52:31Z")

</div>

Hi there!

Just wanted you to know that you are a bunch of warriors to create such a revolutionary OS.

I battled the whole weekend to get it working, but I managed to build a working qemu image in a matter of seconds now, without even using the iso.  
It’s also very simpler to apply a cloud-config and copy files in the OS in a declarative way.  
I’d like to know what you guys think of this approach (it looks a bit like ./scripts/run from rancher/os ).

Here is the script:

```auto
#!bin/sh

set -x -e

function clean_up {

    sudo umount mount || true
    sudo kpartx -d rancheros.img || true
    sudo losetup -d /dev/loop0 || true
}

trap "clean_up; exit" SIGHUP SIGINT SIGTERM
clean_up

qemu-img create rancheros.img 1G
sudo losetup /dev/loop0 rancheros.img

echo "n
p
1

w" | sudo fdisk /dev/loop0 || true

sudo kpartx -a rancheros.img

docker run --privileged -it \
    -v /dev/mapper:/dev/mapper \
    -v $(pwd):/cluster \
    rancher/os:v0.4.2-rc2 \
        -c /cluster/cloud-config.yml \
        -t generic \
        -d /cluster/rancheros.img \
        -p /dev/mapper/loop1p1 \
        #-f /cluster/images.tar.xz:var/lib/system-docker/preload/images.tar.xz

sync

qemu-system-x86_64 -enable-kvm \
    -m 1024 \
    -net nic,model=virtio \
    -net user,hostfwd=tcp::2222-:22 \
    -drive if=virtio,file=rancheros.img,format=raw

```

---

<div class="post-metadata">

**Author:** ![SvenDowideit](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/svendowideit/32/2159_2.png) [@SvenDowideit](https://forums.suse.com/u/SvenDowideit)\
**Post date:** [March 24, 2017, 1:55am UTC](https://forums.suse.com/t/proposal-to-install-on-qemu/1236/2 "2017-03-24T01:55:54Z")

</div>

oh man, that’s just brilliant.

I broke this in the re-write of the installer in 0.8 (as seen in [https://github.com/rancher/os/issues/1667](https://github.com/rancher/os/issues/1667) )

but lets see if i can fix it quickly. (and then add it to our tests…)

---

<div class="post-metadata">

**Author:** ![SvenDowideit](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/svendowideit/32/2159_2.png) [@SvenDowideit](https://forums.suse.com/u/SvenDowideit)\
**Post date:** [March 24, 2017, 12:50pm UTC](https://forums.suse.com/t/proposal-to-install-on-qemu/1236/3 "2017-03-24T12:50:32Z")

</div>

I’ve started work on this in [https://github.com/rancher/os/pull/1724](https://github.com/rancher/os/pull/1724) , and its a nice example of what you can do

but for the sake of completness, [https://github.com/rancher/os/tree/master/scripts/images/openstack](https://github.com/rancher/os/tree/master/scripts/images/openstack) is the way we’ve been doing it for releases

---

<div class="post-metadata">

**Author:** ![SvenDowideit](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/svendowideit/32/2159_2.png) [@SvenDowideit](https://forums.suse.com/u/SvenDowideit)\
**Post date:** [March 27, 2017, 2:01am UTC](https://forums.suse.com/t/proposal-to-install-on-qemu/1236/4 "2017-03-27T02:01:44Z")

</div>

The slightly modified version can now be found in the repository as [https://github.com/rancher/os/blob/master/scripts/run-install](https://github.com/rancher/os/blob/master/scripts/run-install)
