Creating a plain Ubuntu Server 12.04 LTS on Virtualbox; notes on Apache + Python options

I need to be working on budget proposals today. SIgh. So, in a fit of classic avoidance behavior, I decided to jot down a set of notes and links for configuring Ubuntu Server 12.04 (LTS) under VirtualBox, primarily so that I can experiment with some Python + Apache stuff. Here you go – this is very rough, as I was just trying to get things out of a jumbled set of Google searches and into some sort of order.

  1. Install VirtualBox 4.2 (https://www.virtualbox.org/)
  2. Install VirtualBox extension pack for 4.2 (same place)
  3. Visit http://www.ubuntu.com/download/server . Choose the LTS 12.04 version.
  4. Download ISO – it’s about 657MB in size.
  5. Install and configure Ubuntu. Create an administrative account, like “manager”, “installer”, etc. This will be the account that can sudo.
  6. Install the VB guest additions if you think that you will need them.
  7. Install ssh and apache: sudo apt-get install ssh apache2
  8. Consider configuring the virtual box to be NAT with port-forwarding so that you can SSH in, etc.
    1. A quick side-note on this. On the Mac, at least, it’s painful trying to use the GUI to forward ports from the NATed guest to the host. Here’s a quick and hackish way to manually set them.
    2. Shut down the guest first because you’re going to manually edit its config file. Assume that the machine is called “UbuntuServer” in VirtualBox.
    3. Navigate to “VirtualBox VMs/UbuntuServer” in your home directory on your Mac. Edit the file labeled “UbuntuServer.vbox”. Do a search for “<NAT>”. Add the following lines to the NAT paragraph:
      1. <Forwarding name=”HTTP” proto=”1″ hostport=”9980″ guestport=”80″/>
        <Forwarding name=”SSH” proto=”1″ hostport=”9922″ guestport=”22″/>
      2. Save the file and exit. When you restart the guest, you will be able to connect to the guest Apache by visiting – http://localhost:9980 and you’ll be able to ssh into the guest by doing “ssh installer@localhost:9922”.
  9. Verify that you get the “It works” page when you visit “http://localhost:9980&#8221;.
  10. Do apt-get update && apt-get dist-upgrade.
  11. Stop. Make a snapshot or a clone of your nice pristine VB machine of Ubuntu server 12.04 with Apache. Not using snapshots and clones? You really should be. It’s a great and often overlooked feature.
  12. If you want, you can follow the LAMP server installation instructions from Falko Timme here: http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-ubuntu-12.04-lts-lamp
  13. For the Debian/Ubuntu way to manage multiple sites and virtual hosts, see the following:
    1. http://www.debian-administration.org/articles/412
    2. http://manpages.ubuntu.com/manpages/precise/man8/a2ensite.8.html
  14. Configuring python support within Apache2
    1. If you want to write cgi for Apache with python use mod_wsgi anyway. See these notes (http://stackoverflow.com/questions/3319545/mod-wsgi-mod-python-or-just-cgi) and these notes (http://www.electricmonk.nl/docs/apache_fastcgi_python/apache_fastcgi_python.html)
    2. Alternatives to the long-dormant mod_python: http://blog.dscpl.com.au/2010/05/modpython-project-soon-to-be-officially.html
    3. Low-level frameworks (non-Django) – see Flask (http://flask.pocoo.org/).
    4. Django: https://www.djangoproject.com/
  15. Consider installing Postgresql. Follow instructions like these: http://bit.ly/V6pwNX

Take a break – you’ve earned it. 🙂 See any errors? Have any comments? Let me know. As usual, I’m just gathering resources from around the web. Thank you to all of the experts who write down and share their knowledge with the rest of us!

Advertisements

2 thoughts on “Creating a plain Ubuntu Server 12.04 LTS on Virtualbox; notes on Apache + Python options

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s