MOS VM

aus Metalab, dem offenen Zentrum für meta-disziplinäre Magier und technisch-kreative Enthusiasten.
Wechseln zu: Navigation, Suche

MOS/VM

MOS VM
Mos vm.png

Gestartet:

21.01.2013

Involvierte:

User:queltos

Status:

awesome

Beschreibung:

Build your own virtual machine for MOS development using Vagrant

Zuletzt aktualisiert:

22.02.2014


Build your own virtual machine for MOS development using Vagrant.

Done with:

  • Ubuntu 12.04 LTS 64bit
  • Oracle VM VirtualBox Manager 4.1.12_Ubuntu
  • Vagrant 1.4.3 (downloaded the .deb from http://www.vagrantup.com/downloads.html and installed with GDebi as the version provided by Ubuntu won't work)


Step 1: Checkout MOS from github

$ git clone https://github.com/Metalab/mos.git

Step 2: cd into the project directory

$ cd mos

Step 3: Switch to the django_1_5_compatibility branch

$ git checkout django_1_5_compatibility

Step 4: Call vagrant to build and setup your VM

$ vagrant up

You should see something like

Bringing machine 'default' up with 'virtualbox' provider...
[default] Box 'debian-7.4.0-amd64_virtualbox.box' was not found. Fetching box from specified URL for
the provider 'virtualbox'. Note that if the URL does not have
a box for this provider, you should interrupt Vagrant now and add
the box yourself. Otherwise Vagrant will attempt to download the
full box prior to discovering this error.
Downloading box from URL: https://dl.dropboxusercontent.com/s/c7z3xqr0ewxjalk/debian-7.4.0-amd64_virtualbox.box
Extracting box...te: 4217k/s, Estimated time remaining: --:--:--)
Successfully added box 'debian-7.4.0-amd64_virtualbox.box' with provider 'virtualbox'!
[default] Importing base box 'debian-7.4.0-amd64_virtualbox.box'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] -- 8000 => 8000 (adapter 1)
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
[default] The guest additions on this VM do not match the installed version of
VirtualBox! In most cases this is fine, but in rare cases it can
prevent things such as shared folders from working properly. If you see
shared folder errors, please make sure the guest additions within the
virtual machine match the version of VirtualBox you have installed on
your host and reload your VM.

Guest Additions Version: 4.2.16
VirtualBox Version: 4.1
[default] Mounting shared folders...
[default] -- /vagrant
[default] Running provisioner: shell...
[default] Running: /tmp/vagrant-shell20140221-5693-1bu2kai
stdin: is not a tty

PLAY [all] ******************************************************************** 

GATHERING FACTS *************************************************************** 
ok: [localhost]

TASK: [apt update_cache=yes] ************************************************** 
ok: [localhost]

TASK: [apt pkg=build-essential] *********************************************** 
changed: [localhost]

TASK: [pip requirements=/vagrant/requirements.txt] **************************** 
changed: [localhost]

TASK: [link /mos -> /vagrant] ************************************************* 
changed: [localhost]

TASK: [syncdb] **************************************************************** 
changed: [localhost]

TASK: [lineinfile dest=/home/vagrant/.bashrc line='cd /mos'] ****************** 
changed: [localhost]

PLAY RECAP ******************************************************************** 
localhost                  : ok=7    changed=5    unreachable=0    failed=0

Step 5: Login into your VM

$ vagrant ssh

You should see something like:

Linux debian-7 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Feb 21 20:41:55 2014 from 10.0.2.2
vagrant@debian-7:/mos$ 

Step 6: Create an initial superuser for your MOS (do this IN the ssh session you openend before in step 5)

vagrant@debian-7:/mos$ ./manage.py createsuperuser

You will be asked for the username and password:

Username: quux
Email address: 
Password: 
Password (again): 
Superuser created successfully.

This user can be used to login into the MOS through the web frontend

Step 7: Run the MOS inside your VM

vagrant@debian-7:/mos$ ./manage.py runserver 0.0.0.0:8000

You should see something like:

Validating models...

0 errors found
Februar 22, 2014 - 01:35:07
Django version 1.5.5, using settings 'mos.settings.devel'
Development server is running at http://0.0.0.0:8000/
Quit the server with CONTROL-C.

Step 8: Open a browser on your host machine and connect to http://localhost:8000/

Step 9: Login into MOS with a click on "Login" and provide the credentials used in step 6

Step 10: Profit!

Hint: After login into your VM will be in the directory from your host where you checked out the project. You can edit files on your host and the changes will be visible inside your VM.

If you are done with hacking stop the VM from your host with

$ vagrant halt

To start it again just enter:

$ vagrant up

You will see something like:

Bringing machine 'default' up with 'virtualbox' provider...
[default] Clearing any previously set forwarded ports...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] -- 8000 => 8000 (adapter 1)
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
[default] The guest additions on this VM do not match the installed version of
VirtualBox! In most cases this is fine, but in rare cases it can
prevent things such as shared folders from working properly. If you see
shared folder errors, please make sure the guest additions within the
virtual machine match the version of VirtualBox you have installed on
your host and reload your VM.

Guest Additions Version: 4.2.16
VirtualBox Version: 4.1
[default] Mounting shared folders...
[default] -- /vagrant
[default] VM already provisioned. Run `vagrant provision` or use `--provision` to force it

No worries, the last line is not an error :)

btw, don't forget to login into it and start MOS again