View Issue
Home
» Newsletters
» View Issue
The SitePoint TECH TIMES #263 Copyright (c) 2009
October 27th, 2009 PLEASE FORWARD
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Tips, Tricks, News and Reviews for Web Coders
by Kevin Yank (techtimes@sitepoint.com)
Read the HTML version of this newsletter, with graphics, at:
http://www.sitepoint.com/newsletter/viewissue.php?id=3&issue=263
Note: This newsletter is supported solely by advertisers like the
one below. We stand 100% behind every ad that we run. If you ever
have a problem with a company that advertises here please contact
us and we will try to get it resolved.
INTRODUCTION - - - - - - - - - - - - - - - - - - - - - - - - - -
Say, what do you know about ... virtualization? For many
developers, "virtualization" is an intimidating term -- one
might even call it spooky (especially if one were writing a
newsletter intro just before Halloween!).
Virtualization is a fancy term for running one or more operating
systems as "guests" on your computer, sharing the same hardware
as the main ("host") operating system. Once limited to high-end
enterprise servers, the technology to support speedy
virtualization is now built into any computer that's more
powerful than a cheap netbook.
In this issue, Louis -- our latest team member -- shows you how
to set up your own virtual Linux server on your computer for
free, using Sun's VirtualBox. So you can take the money you save
and spend it on Halloween candy!
SPONSOR'S MESSAGE - - - - - - - - - - - - - - - - - - - - - - - -
101 Essential CSS Tips, Tricks, and Hacks
Stop wasting hours trying to fix CSS code using the old, outdated
answers you find via Google. Our 101 tested and proven CSS solutions
are all you need.
Grab four free sample chapters
http://www.sitepoint.com/books/cssant3/
IN THIS ISSUE - - - - - - - - - - - - - - - - - - - - - - - - - -
- Introduction
- Think Outside the Box with VirtualBox
- New Technical Articles
- Techy Forum Threads
- More Techy Blog Entries
THINK OUTSIDE THE BOX WITH VIRTUALBOX - - - - - - - - - - - - - -
Sun's VirtualBox [1] is ideal for testing different desktop
environments (for example, browser testing), but I've discovered
it's also great for running a test server environment. Instead of
setting up Apache, PHP, and MySQL right on your desktop machine,
you can place them in a virtual Linux server. That way there's
no interference with your desktop, and you can ensure that your
development environment is as close as possible to your eventual
deployment environment.
With a virtual Linux server running inside your desktop
operating system, you can SSH into it, upload files to it, load
web pages from it -- whatever you'd do with a real live server.
And all the software you need is free and simple to configure.
Let's make a start!
SETTING UP SHOP
The first step is to download the VirtualBox client [2]. Pick
the version appropriate for your host system.
You'll also want to grab a disk image for your Linux server. For
this tutorial, I'll be using the 64-bit version of Ubuntu server
9.04 [3], but feel free to use whatever distribution you're more
comfortable with. Of course, you might need to adapt some of the
instructions to your particular setup.
We could also use a desktop build, but since we're only
interested in the server functionality, it's best to stick with
a server build: we'll save on memory because no graphical
desktop interface is loaded.
INSTALLING THE UBUNTU SERVER
Start up VirtualBox and click New for a new virtual machine.
Step through the wizard, making sure to choose the 64-bit
version of Ubuntu (if that's the disk image you downloaded). I
used the defaults for every other option: RAM, disk size, disk
type, and so on.
Now select your new VM and click Start. VirtualBox will ask you
how to install the OS on your virtual machine. Since we
downloaded an .iso, choose CD/DVD-ROM device from the Media Type
menu and Image File from the Media Source menu, selecting your
Ubuntu Server iso. As the system boots, you'll be presented with
Ubuntu's installer. Choose your language, and then select Install
Ubuntu Server.
Follow the on-screen instructions to install the server. Notice
that when you come to partitioning your hard disk, the virtual
machine only "sees" the disk image you created before. Feel free
to use the whole disk. Later on in the process, the installer
will prompt you to install additional software. For our
purposes, we'll install the LAMP server and OpenSSH server
packages. This way we have everything we need for a fully
functional web server out of the box.
When it comes time to reboot your new server, you can "eject"
the installation CD by choosing Devices>Unmount CD/DVD-ROM from
the VirtualBox menu.
Log into your new system with the username and password you
chose during installation. It's also a good idea to upgrade your
system with:
sudo aptitude update
sudo aptitude safe-upgrade
ACCESSING THE VIRTUAL SERVER FROM THE HOST SYSTEM
Now that our server is up and running, we want to be able to
access it from our host system. We'll set it up so we can SSH to
it, transfer files to it via SFTP, and make HTTP requests to
Apache.
To do all this we need to edit the xml configuration file for
our virtual machine:
- On a Mac, the file is found at
~/Library/VirtualBox/Machines/<machine name>/<machine name>.xml
- On Windows, it's inside the .VirtualBox/Machines subdirectory
in your home folder.
So for my machine, which I've called "Ubuntu Server," I'm
editing Machines/Ubuntu Server/Ubuntu Server.xml
At the top of the file you should see an <ExternalData> tag.
Inside that tag, copy in the following tags:
<ExtraDataItem
name="VBoxInternal/Devices/pcnet/0/LUN#0/ Config/ssh/HostPort"
value="2222"/> <ExtraDataItem
name="VBoxInternal/Devices/pcnet/0/LUN#0/ Config/ssh/GuestPort"
value="22"/> <ExtraDataItem
name="VBoxInternal/Devices/pcnet/0/LUN#0/ Config/ssh/Protocol"
value="TCP"/> <ExtraDataItem
name="VBoxInternal/Devices/pcnet/0/LUN#0/
Config/apache/HostPort" value="8888"/> <ExtraDataItem
name="VBoxInternal/Devices/pcnet/0/LUN#0/
Config/apache/GuestPort" value="80"/> <ExtraDataItem
name="VBoxInternal/Devices/pcnet/0/LUN#0/
Config/apache/Protocol" value="TCP"/>
(Note: there should be no line breaks in the "name" attribute;
I've put them in purely for formatting here.)
These lines configure VirtualBox to forward requests to specific
ports on the host system onto other specified ports on the guest
system. For SSH, we're forwarding port 2222 of the host system
to port 22 of the guest system (where OpenSSH is listening). The
same principle applies to the Apache configuration items, with
port 8888 on the host mapping to port 80 on the guest.
With that done, save the xml file and restart your virtual
machine.
If the machine fails to start, it's likely to be because of a
network interface configuration problem. In the lines we added,
we specified pcnet as the network interface. To ensure that's
what your virtual machine is using, right-click on it in the
main VirtualBox window and click Settings. In the Network tab,
select one of the PCnet adapters from the Adapter Type
drop-down. You should be able to restart your virtual machine
with no problems now.
Now if you open a browser on your host system and point it to
http://localhost:8888/ you should see the default Apache "It
works!" page. Great!
Similarly, to SSH into your new server, SSH to port 2222 on
localhost with the username you set during the Ubuntu server
installation. (If you're on Windows, you can use the PuTTY [4]
SSH client to perform the same function):
ssh -l <username> -p 2222 localhost
You'll receive the usual "unknown host" security warning; type
"yes" to connect and you'll be prompted for your password. Upon
entering it, you should be logged in to your server! Feel free
to look around and make yourself at home.
While we're still logged in, let's do one more task: by default
the Apache web root in Ubuntu Server is /var/www/, which your
default user won't have write permissions for. Let's change
that, so you can upload files to your web root with SFTP. Enter
this command and hit return:
sudo chown <username> /var/www
To connect to your server with FTP, no extra configuration is
necessary. OpenSSH gives you "free" FTP via the SFTP (SSH FTP)
protocol. Most clients (FileZilla [5], for example) support it;
just choose SFTP as the protocol, localhost as the server with
port 2222, and your Ubuntu username and password. Choose
/var/www/ as the default directory, and you should be able to
transfer files to and from your server.
Let's test that everything is working: create a php file named
info.php containing the usual phpinfo call:
<?php
phpinfo(); ?>
Use your FTP client to upload that file to your server's
/var/www/ folder. Now point your browser to
http://localhost:8888/info.php, and you'll see the PHP info
page. The System row at the top of the table will tell you PHP
is running on Ubuntu.
There you have it! You can test server configurations, brush up
on your sysadmin skills, and develop your web sites and
applications in a full Linux server environment running inside
your usual desktop.
Web Tech Blog: Technically Speaking
by Louis Simoneau
Build Your Own Dev Server with VirtualBox [6]
[1] <http://virtualbox.org>
[2] <http://www.virtualbox.org/wiki/Downloads>
[3] <http://www.ubuntu.com/getubuntu/download-server>
[4] <http://www.chiark.greenend.org.uk/~sgtatham/putty/>
[5] <http://filezilla-project.org/>
[6] <http://www.sitepoint.com/blogs/2009/10/27/build-your-own-dev-server-with-virtualbox>
SPONSOR'S MESSAGE - - - - - - - - - - - - - - - - - - - - - - - -
Build Better Apps in a Snap
With Adobe® Flex® Builder™ 3 software, you can quickly create engaging
applications, and consistently deliver highly interactive experiences
to your clients. Flex Builder 3 is an Eclipse® based development tool,
enabling intelligent code hinting, interactive step-through debugging,
and visual design of user interface layout, appearance, and behavior.
So providing a compelling user experience is simple, fast, and
easy—every single time.
Download Flex Builder 3 to expand your capabilities for creating rich
Internet applications (RIAs).
http://ad.doubleclick.net/clk;218593038;41682049;m
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
See you next week for another not-so-spooky issue of the Tech
Times!
Kevin Yank
techtimes@sitepoint.com [1]
Editor, SitePoint Tech Times
[1] <mailto:techtimes@sitepoint.com>
NEW TECHNICAL ARTICLES - - - - - - - - - - - - - - - - - - - - -
Spice up your Firefox Extensions with a Dash of HTML
by James Edwards
Want your Firefox extension to stand out from the crowd? Wish
extensions were as easy to style as web pages? In this
article, James
shows us how to give an extension that extra bit of flair
by mixing HTML
right into an XUL document.
http://articles.sitepoint.com/article/firefox-extensions-with-html
TECHY FORUM THREADS - - - - - - - - - - - - - - - - - - - - - - -
How can split and display data retrieved from datavase containing
commas
<http://www.sitepoint.com/forums/showthread.php?threadid=643024>
effect of dedicated IP on SEO?
<http://www.sitepoint.com/forums/showthread.php?threadid=643932>
Image Replacement--Why Is Text on Top?
<http://www.sitepoint.com/forums/showthread.php?threadid=643907>
Installing PHP (5.3 currently) on Windows
<http://www.sitepoint.com/forums/showthread.php?threadid=643882>
function on a checkbox? **noob**
<http://www.sitepoint.com/forums/showthread.php?threadid=643560>
Google Maps API
<http://www.sitepoint.com/forums/showthread.php?threadid=643314>
Hacked for a third time!!!
<http://www.sitepoint.com/forums/showthread.php?threadid=643260>
PNG transparent parts look black
<http://www.sitepoint.com/forums/showthread.php?threadid=643131>
MORE TECHY BLOG ENTRIES - - - - - - - - - - - - - - - - - - - - -
News & Trends Blog: INDUSTRY NEWS FOR WEB PROFESSIONALS
What is a Browser? Google Explains... (9 comments)
http://www.sitepoint.com/blogs/2009/10/27/google-explains-browsers/
Windows 7 Launch Marred by Software Pirates (20 comments)
http://www.sitepoint.com/blogs/2009/10/23/windows-7-pirated/
Microsoft Windows 7: the Launch Day and its Future (12 comments)
http://www.sitepoint.com/blogs/2009/10/22/microsoft-windows-7-launch-and-future/
Podcast Blog: THE SITEPOINT PODCAST
SitePoint Podcast #33: Team Opera at WDS09
http://www.sitepoint.com/blogs/2009/10/23/podcast-33-team-opera-wds09/
JavaScript & CSS Blog: STYLISH SCRIPTING
Fixing Object Instances in JavaScript (21 comments)
http://www.sitepoint.com/blogs/2009/10/21/javascript-object-instances/
ADVERTISING INFORMATION - - - - - - - - - - - - - - - - - - - - -
Find out what thousands of savvy Internet marketers already know:
email newsletter advertising works! (You're reading an email ad
now, aren't you?)
Find out how to get YOUR sponsorship ad in this newsletter and
reach 95,000+ opt-in subscribers! Check out
http://www.sitepoint.com/mediakit/ for details, or email us at
mailto:adinfo@sitepoint.com
HELP YOUR FRIENDS OUT - - - - - - - - - - - - - - - - - - - - - -
People you care about can take charge of their Website by
effectively using the information and resources available on the
Internet. Help them learn how - forward them a copy
of this week's SitePoint Tech Times.
ADDRESSES - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Send suggestions and comments to:
techtimes@sitepoint.com
To subscribe, send a blank email to:
subscribe@sitepoint.com
The Archives are located at:
http://www.sitepoint.com/newsletter/archives.php
The SitePoint Tech Times is (c) 1998-2009 SitePoint Pty. Ltd. All
Rights Reserved. No part of this Newsletter may be reproduced in
whole or in part without written permission. All guest articles
are copyright their respective owners and are reproduced with
permission.
SitePoint Pty. Ltd.
48 Cambridge Street
Collingwood, VIC 3066
AUSTRALIA
You are currently subscribed to The SitePoint Tech Times as:
[email]
To change the email address that you currently subscribe with:
http://sitepoint.com/newsletter/manage.php
To switch to the HTML version of this newsletter:
<http://sitepoint.com/newsletter/htmlplease.php?email=[email]>
To leave this list, please visit:
[unsubscribe]
Do Not Reply to this email to unsubscribe.
We send this newsletter using Campaign Monitor.
http://www.campaignmonitor.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Topics
Download sample chapters of any of our popular books.
Learn more with SitePoint books

