CloudFellow Map Dork and good Twitter friend Don Meltz has been writing a series of blog posts about his trials and tribulations while setting up a homebrewed map server on an old Dell Inspiron (here and here).  I strongly recommend giving them a read.

At the outset, Don ran his GeoSandbox on Windows XP, but recently he switched over to Ubuntu.  While I applaud this decision whole-heartedly, I thought I’d take the extra step and build my own map server on a headless Ubuntu Server box (when I say ‘headless’, I am talking about an eventual goal.  To set this all up, the computer in question will initially need to have a monitor and keyboard plugged into it, as well as an internet connection.  When the dust settles, all that need remain is the internet connection).  The following is a quick walkthrough of the process.  I apologize to any non-Map Dorks who may be reading this.

The process begins, of course, with the installation of Ubuntu 10.04 Server Edition.  Download it, burn it to a disk, and install it on the machine you have chosen to be your server.  Read the screens that come up during installation and make the decisions that are appropriate for your life.  The only one of these I feel compelled to comment on is the software selection:


The above image shows my choices (what the hell – install everything, right?).  Definitely install Samba shares.  It allows Linux machines to talk to others.  Also, be sure to install the OpenSSH server.  You’ll need it.  For our purposes, there’s no real reason to install a print server, and installing a mail server will cause the computer to ask you a slew of configuration questions you’re probably not prepared to answer.  Give it a pass.

During the installation process, you will be asked to give your server a name.  I named mine ‘maps’.  So whenever I write ‘maps’, substitute the name you give your own machine.

Once your installation is complete, you will be asked to login to your new server (using the username and password you provided during installation), after which you will be presented with a blinking white underscore (_) on a black screen.  This is a command prompt, and you need not fear it.  I’ll walk you through the process of using it to give yourself a better interface with which to communicate with your server.  Hang tight.

Let’s begin the process by taking control of the machine.  Type in “sudo su” (sans quotation marks) and hit ‘enter’.  The server will ask for your password, and after you supply it, you will be able to do pretty much anything you want.  You are now what is sometimes called a superuser, or root.  What it means is that you are now speaking to your computer in terms it cannot ignore.  This circumstance should be treated with respect.  At this stage, your server will erase itself if you tell it to (and it won’t ask you whether or not you’re sure about it – it’ll just go ahead and obey your orders).  So double-check your typing before you hit ‘enter’.

Now, let’s get ourselves a GUI (Graphical User Interface).  The server edition we’re using doesn’t have its own GUI, and for good reasons (both resource conservation and security).  Instead, we can install Webmin, a software package that allows us to connect to our server using a web browser on another computer on the same network.  We’ll do this using the command line.  Type in (ignore the bullets before each command.  They are only there to let you know where each new line begins):

And hit ‘enter’ (I’m not going to keep repeating this.  Just assume that hitting ‘enter’ is something you should do after entering commands{the dark words}).  Follow this with:

  • sudo dpkg -i webmin-current.deb

And finish it up with:

  • sudo apt-get -f install

Now we have a GUI in place.  If you open a browser on another computer on your network and type: https://maps:10000 into the location bar (remember to replace ‘maps’ with the name you gave your own server), you’ll be asked to supply your username and password, then you’ll see this (you may also be asked to verify Webmin’s certificate, depending on your browser):

Cool, huh?  Don’t get your hopes up, though.  We’re not done with the command line yet (don’t sweat it – I’ll hold your hand along the way.  Besides – you should learn to be comfortable with the command line).  For the moment, though, let’s take a look around the Webmin interface.  There is a lot this program can do, and if you can find the time and determination it would be a good idea to learn your way through it.  For now, you just really need to know a few options.  The first is that the initial page will notify you if any of your packages (Linux for ‘software’) have available updates.  It’s a good idea to take care of them.  If you want, Webmin can be told to do this automatically (on the update page you get to when you click through).  The other important features are both located under the ‘Other’ menu (on the left).  The first is the file manager (which bears a striking resemblance to the Windows File Manager of old), which gives you the ability to explore and modify the file system on your server (this feature runs on Java, so be sure the browser you’re using can handle it).  The other feature is ‘Upload and Download’ which does what it says it does.  Together, these two features give you the ability to put maps on your map server, something I assume you’ll want to do.

Please note the specs on my server (as pictured above).  It’s not terribly different than Don’s Inspiron.  I’m not suggesting you do the same, but it is worth noting that an old machine can handle this job.

Back to the command line.  Let’s get OpenGeo:

Rock and roll.  When your server is done doing what it needs to do, go back to the browser you used for Webmin and type http://maps:8080/dashboard/ into the location bar.  Check out the OpenGeo goodness.

Finally, to make your new server truly headless, you’re going to need some way to login remotely (when you turn the machine on, it won’t do a damn thing until you give it a username and password).  Since you listened to me earlier and installed the OpenSSH server, you’ll be able to do this.  All you need is an SSH client.  If you’re remotely connecting through a Linux machine, chances are you already have one.  In the terminal, just type:

  • ssh <username>@<computer name or IP address>

In my case, this would be:

  • ssh terry@maps

You’ll be asked for a password, and then you’re in (I hear this works the same in OS X, but I cannot confirm it).

If you’re using a Windows machine – or if you just prefer a GUI – you can use PuTTY.  PuTTY is very simple to use (and it comes as an executable.  I love programs that don’t mess with the registry).  Tell it the name of the computer you want to connect to and it opens a console window asking for your username and password.  Tell it what it wants to know.

It’s not a bad idea to install a new, dedicated browser for use with your new server.  I used Safari, but only because I already use Firefox and Chrome for other purposes.  Also, your network will probably give your server a dynamic IP address.  This is not an issue for you, since your network can identify the machine by name.  If you want to (and there are several valid reasons to do so), you can assign a static IP address to your server.  To find out how to do so, just search around a bit at the extraordinary Ubuntu ForumsUpdate:  It seem that Webmin provides an easy method to assign a static IP address to your server.  Go to Networking → Network Configuration → Network Interfaces → Activated at Boot.  Click on the name of your active connection, and you will then be able to assign a static IP address just by filling in boxes.

Enjoy your map server.  If I can find the time, I’ll write up a post on how I added Flex Viewer, TileMill and TileStream to the server:

And 50 bonus points to anyone who understands the image at the top of this post.