-
Notifications
You must be signed in to change notification settings - Fork 0
Archive Trac vm runnotes
Legacy Trac archive page imported from
vm_runnotes. Source: https://genapp.rocks/wiki/wiki/vm_runnotes. Review age, links, and examples before treating as current.
- do you have a computer capable of running as an efficient vm host ?
- it can not be itself a virtual machine
- it should be a 64 bit os
- it needs to have enough ram and disk space to give the vm guest enough resources
-
for non-OSX
- make sure you have virtualization enabled in the system bios
-
the vm's are typically distributed as vdi or qcow2 format
-
if you are going to use virtualbox (recommended), get the vdi directly or convert from qcow
- to convert from qcow2
- make sure you have qemu installed or that your vm manager supports qcow2
- if you install qemu, you can check the image after compressing with
- $ qemu-img info imagefile
-
get the image
-
uncompress if necessary
- typically we distribute vm's as .7z files which require p7zip software or .zip files
- for 7z software
- ubuntu $ sudo apt-get install p7zip-full
- OSX ?
- make sure port forwarding is ok
- $ cat /proc/sys/net/ipv4/ip_forward
- if it returns 0
- $ sudo echo 1 > /proc/sys/net/ipv4/ip_forward
- works with OSX, Linux, Windows
- after following the instructions for all os's
- install virtualbox
- virtualbox does not support qcow2 format, so if your image is qcow2:
- convert the image to vdi
$ qemu-img convert -f qcow2 -O raw 'image'.img 'image'_raw.img
$ VBoxManage convertfromraw --format VDI 'image'_raw.img 'image'.vdi
-
the vdi file should work with virtualbox
-
run virtualbox
-
bring in as "new" to virtualbox
- on first dialog
- Name: give it some name
- Type: linux
- Version: linux 2.6/3.x (64 bit) or Other linux (64-bit)
- dialog 2:
- give at least 2 GB memory, min 4 GB recommended, but more is better if you have it available
- dialog 3:
- select "Use an existing virtual hard drive image"
- find the .vdi file you made above
- this should setup the vm guest
-
network configuration
- you need to create a host-only network
- in virtualbox->preferences
- select "network"
- select "host only networks"
- if none are listed, click the green "+" to the right of the list to create vboxnet0
- in the man virtual box window, select your guest
- select "settings"->network
- adapter 1
- set "attached to" to "host-only adapter"
- name: "virtbox0" should come up
- adapter 2
- check enable network adapter
- set "attached to" to "NAT" (not "NAT Network")
-
boot up the vm with "start" in virtualbox
-
you can select and press the start green arrow
-
once booted up
-
login as root
-
- you should see an eth0 and eth1 at this point
- if not, you have an issue with network configuration and can not proceed
- if ok
- you need to edit once /usr/local/bin/etherup
- comment out the two lines with a # in the first column and then add a line with
- you should see an eth0 and eth1 at this point
-
dhcpcd eth0
sleep 60
dhcpcd eth1
- this should get you default network on boot up
- set ip address in appconfig.json
- there will be copies in /home/ehb/genapptest, /share/apps/genapp/sassie2 and /share/apps/genapp/sassie2test
- some vm images may not have sassie2test
- if you want to install a new sassie2test or other vm image, after everything you have completed the steps below (to the end of "once working"), follow these instructions
- edit them all
,"hostip" : "192.168.56.101"
,"hostname" : "192.168.56.101"
- add your user
- adduser
- make sure apache is an additional group
- allow ssh access for your user
- edit /etc/ssh/sshd_config and put your user name on the row that says "AllowUsers"
- you can remove any user names that are there
- e.g.
AllowUsers myusername
- for sudo access
- visudo
- change the ehb line to your myusername and save
- reboot
- # init 6
- once working
- from the host machine (osx, linux, windows) (not within the vm guest)
- go to the sassie2 web page http://192.168.56.101/sassie2
- go to the sassie2test web page http://192.168.56.101/sassie2test
- ssh to the guest $ ssh myusername@192.168.56.101
- if you want to shut down the vm
- ssh in to the guest and $ sudo su, # init 0
- a nice way is to use virtualbox to close->save state
- this will restart the guest at the point you left off
- ssh connections will be lost
- we recommend you use virtualbox
- tested with ubuntu 14.04 64 bit
- get the vm software
- $ sudo apt-get update
- $ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
- then:
- $ sudo qemu-system-x86_64 -enable-kvm yourimagefile.img -smp 2 -m 2048
- in the guest os, # ifconfig -a
- you should see an eth0 at this point
- then # dhcpcd eth0
- should get you network from within the vm
- you need to edit once /usr/local/bin/etherup
- comment out the two lines with a # in the first column and then add a line with
dhcpcd eth0
- this should get you default network on boot up
- this network is within the vm only, but you can run a web browser from within, svn update etc.
- set ip address in appconfig.json
,"hostip" : "10.0.2.15"
,"hostname" : "10.0.2.15"
- and reboot # init 6
-
startup a graphical interface
-
login as yourself, run $ startxfce4
-
alternative using vnc:
-
sudo qemu-system-x86_64 -enable-kvm yourimagefile.img -smp 2 -m 2048 -vga std -vnc :1
-
then you should be able to use a vncviewer ( sudo apt-get vncviewer ) on localhost:1 or from another system to your ip address:1
-
you may need to open a port on the host if you want to access externally
$ sudo iptables -A INPUT -p tcp --dport 5901 -j ACCEPT
- snapshots
- copying the .img makes a snapshot, but there is a faster way
- save the backup full img we made, but you can use the linked instructions for future snapshots as it will be much faster