wiki:InstallationGuidelines/VirtualMachine

Version 5 (modified by Pat Tressel, 13 years ago) ( diff )

--

Installation Guidelines: Virtual Machine

The most convenient way to get up and running is to use a pre-configured development kit -- a complete operating system that's been set up to include all the required code and tools, and saved as an image of the system's disk -- and run this "virtual appliance" in a "virtual machine". The virtual machine runs as an application on your machine -- the "host" machine -- and emulates a separate computer -- the "guest" machine. You won't have to install anything but the virtual machine directly on your system. (We're including the official virtual machine jargon in case you need to read virtual machine documentation.)

The development kit is a Debian Linux system with several useful tools installed:

  • Bazaar (bzr) -- revision control system used on Launchpad, where Sahana eden sources are hosted.
  • Firefox with Firebug for viewing HTTP messages sent to and from the browser.
  • Eclipse with PyDev for editing and debugging Python code.
  • Aliases for common commands.

Get the Sahana Eden development kit image

  • The image is compressed -- uncompress it. The extracted file will have an .ovf extension.
    • On Windows, a good tool for (un)compressing is 7-Zip.
    • On Linux / Unix, use tar xzf to uncompress the file, e.g. if the name of the downloaded image file is filename.tar.gz then do:
      tar xzf filename.tar.gz

Install VirtualBox

  • Run the installer (by whatever means is appropriate for your system).
    • Let it install all features.
    • The installation will temporarily disconnect your machine from the network -- take appropriate action if you are running something that can't tolerate that.

Import the image into the virtual machine

  • Start VirtualBox (or let the installer start it).
  • Give VirtualBox the image to run:
    • Select File -> Import Appliance.
    • Click on the Choose button and navigate to and select the uncompressed image (the .ovf file).
    • Click Next.
    • Accept the default appliance options unless you have a reason to make a specific change.

Connect to the network

The VM will appear in the left window pane, and the settings will appear in the right. Next tell the VM about your machine's network interface, so the guest can get to the network. There are two options for having the host and guest share the physical interface, NAT or bridged. NAT is less obtrusive and simpler to set up, but bridged provides more capability to the guest. A discussion of the differences is here. This shows NAT setup:

  • Scroll down on the right side until you see Network -- click that.
  • Select the appropriate network interface (NIC), e.g. switch to wireless if that's what you're using. (Keep this setting in mind -- you may need to change it if you sometimes use a wired network, and sometimes wireless.)
  • Select NAT mode.

Configure the guest system

Security and accounts

The root password is set through a dialog box on first boot.

The development environment is owned by the dev account. When first boot is complete, change its password too: Start a terminal window (from the accessories menu), and enter the command:

passwd dev

Then reboot and use the GUI to log in as user dev.

Note: There is no practical reason to log in in as root. If one needs root privileges, dev has sudo privileges. In a terminal window, to execute one command or a pipeline of commands with root privileges:

sudo command-to-execute-as-root

This will prompt for a password if sudo hasn't been run recently -- it is asking for the current user's password -- here, that's the dev password.

To change passwords after first boot, log in as dev, start a terminal window, and enter the following commands:

sudo passwd root #change root password
passwd #change dev password

The Web2py administration password is set when Web2py is started. For starting Web2py from the command line:

/home/dev/web2py.py -a admin -i 127.0.0.1 -p 80

That will set the administration password to "admin". When Web2py is started from Eclipse, it uses a command that is set when Eclipse is configured -- that will be covered later.

Although it's usually good to get security updates for the operating system and applications, updating may lead to incompatibilities with other software, and has been known to render the system unusable. So do the following only if you know there is a security issue, and not when you're in the middle of something critical.
Log in as dev and execute the following:

sudo apt-get update
sudo apt-get upgrade

File locations

Web2py is located in /home/web2py. Eden is located in /home/web2py/applications/eden. Eclipse and PyDev are preconfigured with this information.

Scripts

/usr/local/bin contains three helpful scripts. To run them, start a terminal window and enter the commands below. They are in all users' paths, so may be executed from any working directory.

Update web2py

Enter the command with or without a revision number, as demonstrated below:

update_web2py 2717 # updates web2py to revision 2717
update_web2py # updates web2py to current revision

Update Eden

update_eden 1560 # updates Eden to revision 1560
update_eden # updates Eden to current revision

Web2Py shell

Launch a Web2py shell in the Eden environment (apologies for the oddly named script).

import_eden

Eclipse

Configure the included Eclipse/PyDev:

Notes

The virtual machine image is based on a blueprint and are configured to use about 512MB of RAM. The virtual disk is configured to expand to 20GB. The virtual machine is built on TurnKey Linux's Core, which in turn is based on Ubuntu 10.04 (Lucid -- the most recent long-term support release). The machine runs Shellinabox, Webmin, and SSH/sftp as services from startup.

The development environment is configured to launch LXDE, a lightweight desktop environment after the first boot. From LXDE, Eclipse with Pydev, Firefox with Firebug, iPython and irssi are accessible.


Procedure for making a new virtual machine image:

InstallationGuidelinesVirtualMachineMaintenance

Note: See TracWiki for help on using the wiki.