You don't need a dedicated server to run web2py

I'm amazed at the performance and efficiency of web2py framework. Most python frameworks are memory hogs and I wouldn't run the application in anything under 512M of memory.  But web2py seems very tight and efficient and quite capable to run in some of the smaller footprints offered by some cloud providers.

I personally use and of course recommend Rackspace Cloud (aff.) where the smallest instance is 256M of RAM with 10G of disk space with larger offerings that give you options to expand this modest VM into a large scale cloud server that rivals a dedicated server

Even with the growth options Rackspace offers, you want to keep your installation tight and to a minimum. There are many Linux flavors, but Ubunto is about the simplest to use for managing your server and like most cloud providers, Rackspace has the latest version LTS 10.04 pre-built and ready to deploy for you.

You probably could get by with a simple Linux-Apache-Python (LAP) install since web2py uses sqlite3 as the database for the model, but a LAMP (+mysql/postgresql) will fit into the reduced memory size.

The following script will install everything you need

wget web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh
chmod +x setup-web2py-ubuntu.sh
./setup-web2py-ubuntu.sh

This will put your web2py install in /home/www-data/web2py.

You may have to run web2py directly from the command line once so that the remainder of the directories and files are created.  This is not done for you in the setup script since it basically configures Apache and starts up web2py via the wsgi.

Just run:

python web2py.py -a "hello"

to create a dummy application and your web2py server running on Ubuntu should be ready to go.

How to Install Apache on Your Dedicated Server

In this lesson you will learn how to install Apache on your Dedicated Server.  If you don't yet have a Dedicated Server on site at your home office or facility, the best thing to do is to open an account at the Rackspace Cloud.  Provision a 256 MB Ubuntu cloud server.  This will run you about $10/month or a few cents per hour if you decide to unprovision the server after completing this lesson.

Apache Web server Installation in Ubuntu
Ubuntu Linux is a great platform to use for an Apache Web server Installation. From a simple machine you can serve web pages to an Intranet or the Internet using one of the most popular Web server configurations.

LAMP Server

For new installations of Ubuntu, the easiest method to get the Apache Web server is by selecting the “LAMP” option on Ubuntu’s software selection screen during installation. This process will get the standard Linux, Apache, MySQL, PHP configuration setup on your server in one automated process.

If you don’t want to configure the server as a LAMP, or if you have other requirements, you can install Apache as a separate application once Ubuntu is installed.

If you went the Rackspace Cloud route, Rackspace has images of Ubuntu already provisioned so you get to skip the installation process and just jump to the Apache installation step.

Download and install Apache Web server

Open a putty session to your server and type “sudo apt-get install apache2” and then press return.

Ubuntu will download and install the Apache Web server software. When the process is complete, you can test your Web server by loading http://localhost (or the IP address assigned to your server) in a browser.

Edit apache2.conf

If the default Apache page doesn’t load, you can try editing the apache2.conf file. Just type in “sudo nano /etc/apache2/apache2.conf” and then press enter to edit the file in Nano. Add the line, “ServerName localhost” to the file and then save and exit. Every time you change apache2.conf you should restart the Apache server so the changes will take effect. Type in sudo apache2ctl restart and press . When this is finished, try browsing to “localhost” in your Firefox browser.

Other considerations

Most of the time, people want to use PHP with Apache. To do this, all you have to do is type “sudo aptitude install php5 libapache2-mod-php5” into a terminal window and then press . If you need to have PHP4 installed, type in “sudo aptitude install php4 libapache2-mod-php4” and then press .

After that, enable the PHP modules by typing in “sudo a2enmod php4” and then pressing and then type “sudo a2enmod php5” followed by hitting the key. Type in sudo apache2ctl restart and press .


As you have seen, Apache Web server installation is really easy in Ubuntu. You can continue to add modules to Apache such as CGI and Perl if necessary. The Apache Web server is one of the most powerful available and is capable of running the most sophisticated Web applications.

Virtualization Solutions for Dedicated Servers

This week, you may want to consider and review solutions that other companies are doing to help consolidate their dedicated servers with virtualization.

On the storage side, SeverWatch is reporting that Virtualization Technologies for Storage Get Real:
The technological issue of storage backup being a big problem once virtual machines are up and running. The most effective way to backup the virtual machines is do so in a way that doesn't involve the box itself being backed up. The easiest and most common way to handle this is to snapshot the virtual machine's image and backup.
Here I agree that snapshots are the easiest way to backup your virtual machine.  But where do you store those images?  CommVault offers a $900/TB license which will enable you to backup your data to the cloud, but what about smaller solutions?

Here you may want to consider CTERA, the "Coolest Cloud Storage Vendor". CTERA offers a plug-in computer that connects to the internet that enables you to backup your data to off-site storage via Rackspace Cloud Files.  A somewhat more cost effective solution especially if you have a small business or home office.

Eventually your business will grow to a point where expansion becomes nearly impossible and you need to look for alternatives.  Take the case where Attorney Nicholas Barrett consolidated twelve Windows 2003 servers into one using dedicated server.  Not only is he saving money, space and energy with virtualization, he has added capacity to grow his business. His solution is to run Citrix (NASDAQ:CTXS) XEN on a single IBM Blade Center S Chassis. To protect his twelve virtual servers, he uses StorageCraft ShadowProtect software to image servers for disaster backup and recovery.

With virtualization, many of the products used to protect your dedicated server are now scaling to provide a solution for your entire infrastructure.  The good news is that there are affordable solutions for both small companies and large enterprises.