Hosting is expensive. So is registering a domain name and renewing it every year — especially for a personal blog or wiki you might not use all that often. So why not host it yourself? It's not as crazy as it sounds.
Of course, we don't actually recommend you host your collaborative Star Trek wiki or trendy food blog on your own machine. What we're referring to are web applications that are just as useful when run locally as they are online. For example, some people maintain personal Wikis for storing notes and private information. Or consider ThinkUp, an app that archives all of your Twitter and Facebook posts, and generates statistics and trends with the results. You could buy a hosting plan and install each of these services online — or you could run them locally, free of charge. You'll get the same results, not to mention the added peace of mind that your personal data is safe, secure and only accessible by you.

Today, we'll focus on installing the aforementioned ThinkUp, one of many legitimate reasons for running online apps and services on your own machine with a local web server. Let's get started!
Getting started with XAMPP
We need two services in particular: mySQL and PHP. The former is a database management system used by most online services, and is responsible for storing everything from password data to user generated content. PHP on the other hand, stands for Hypertext Preprocessor, and is scripting language used to create dynamically generated webpages. This is just one of many methods websites such as Facebook use to serve constantly updated information at a single address, instead of creating static links or pages that must be individually updated.
For our purposes, we'll be using a cross-platform software suite called XAMPP (which stands for Apache, mySQL PHP and Perl). XAMPP will automatically install and configure all the software and services your computer requires for a working local web server. The installation process is similar for both Mac and PC (administrator privileges are required), although Windows users will have the added option of installing Apache, mySQL and PHP as services that launch at startup.

Once installation is complete, you can access the dashboard from your browser via http://localhost/ or http://127.0.0.1. Now click the Security option from the toolbar on the left. Here you can see that a number of services are currently unsecured, which means that other users on the network can technically gain access to the contents of your server (assuming they know your IP, and where to look, of course). In most cases, this is unlikely to be an issue; you probably won't be running XAMPP round-the-clock, or storing particularly sensitive information anyhow. However, if you want to make absolutely sure your server environment is safe, XAMPP provides a simple script to help lock everything down (if you'd rather take your chances, feel free to skip to the next section).
Windows users have it easy. Simply follow the instructions listed on the security page to set a new root username and password for your Apache server and MySQL database. OS X users, however, will need to open up a new session in Terminal and execute the following script:
sudo /Applications/XAMPP/xamppfiles/xampp security

But that's not all. XAMPP's mySQL database still needs to be secured. From the toolbar on the left, this time select phpMyAdmin. Here, you should see a label called "SQL" at the top of the page. Enter the following commands, while replacing 'password' with the password of your choice, (and remember to press 'go' when finished):
UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
FLUSH PRIVILEGES;
Once you refresh the page, you'll notice that your access to the administration panel has now been denied.That's fine, however; while we've changed the password, phpMyAdmin just doesn't know it yet. To fix this, head back to Terminal and type the following (all one line, space after TextEdit):
sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /Applications/XAMPP/xamppfiles/phpmyadmin/config.inc.php
Search for $cfg['Servers'][$i]['password'] = ‘password’; and replace the password after the equals sign with the value we entered in the myPHPadmin panel.
Installing ThinkUp
As previously mentioned, ThinkUp is a neat beta application from former Lifehacker Editor Gina Trapani that archives tweets and Facebook postings for later use. After all, neither service makes searching through and interpreting your online profile easy, something Trapani has sought out to do. After downloading the package from ThinkUp's website, extract it into your htdocs directory (found under /Applications/XAMPP/xamppfiles/), and point your browser at http://localhost/thinkup.

Here, Windows users will notice that not all of XAMPP's services are working correctly. According to ThinkUp, something called cURL has been disabled, and we'll need to reenable it for the application to work. Luckily, this is a simple task. Find your php.ini file in C:\xampp\php\ (or wherever your XAMPP directory is located), and remove the semi-colon before the following line: extension=php_curl.dll. Save, and refresh the ThinkUp page to continue.
OS X users, meanwhile, have a small problem of their own to deal with. Because XAMPP's htdocs folder has its own set of permissions, as you'll have to issue the following command in Terminal as root (all one line)l:
sudo chown -R nobody /Applications/XAMPP/xamppfiles/htdocs/thinkup/_lib/view/compiled_view/
This should allow installation to continue without issue. In the next step, you'll see that ThinkUp now requires some of the information we modified previously, including your root username, password and database host (localhost). Fill in each form accordingly, give ThinkUp a descriptive database name to store its stuff, and you're done.
Well, almost. Windows users will notice that XAMPP throws a an error at the top of the screen, indicating that the service's activation email failed to send. This is because the Windows and OS X packages have different mechanisms for sending outgoing mail. Instead of going through the complicated and tangential process of fixing for our XAMPP mail client, we'll simply make a small edit to activate ThinkUp ourselves.

- Head back to the phpMyAdmin panel, and select the ThinkUp database on the lefthand side.
- Click tu_owners on the lefthand side.
- On the top of the page, select the Structure tab.
- Click the pencil icon beside is_activated
- Change the value beside Default from 0 to 1.
And that's it. Reload ThinkUp, and you can link your accounts as you see fit.
Configuring ThinkUp
Installation is the hard part, of course. Connecting your Facebook and Twitter accounts to the ThinkUp app is relatively easy by comparison. In both cases, you'll have to essentially "create" a Facebook/Twitter application, but only so you can acquire an API key for ThinkUp's crawler. The process is pretty self explanatory, so we won't go into too much detail here.

However, you'll notice in both cases that the address of your web application is required for setup. Since we're not actually running our application online, this could pose a problem. Luckily, there's a workaround. You might remember earlier we mentioned the address of your local server was either http://localhost/ or http://127.0.01/. By choosing the later, both Facebook and Twitter will treat your local web server as an actual address.
Also, it's worth pointing out that ThinkUp isn't perfect, either. Twitter, for example, will only offer the last 3200 available tweets, because the company claims to have no infrastructure in place to handle earlier request. You can't really blame ThinkUp's developers, but it's still a bit of a drag. On the upside, however, you can simply run XAMPP every few days and build up your own working archive yourself.
Conclusion
It's important to note that not all web applications are quite as complicated to install. Wordpress, for example, has its famed "five-minute installation," and the only thing required is you create a database beforehand. And though we've chosen to focus on ThinkUp, this installation process is generally the same for almost every other web application imaginable — from Wikipedia to Moveable Type. Thus, here are a few general rules for installing other web applications to a local web server using this method.

- Always have the root username and password for your mySQL database on hand. Almost every web application you install will require it.
- When installing applications locally, the database host is always localhost.
- Some applications, such as Wordpress, won't create a mySQL database for you. If this is the case, you can create one very easily from the phpMyAdmin panel under the "Create new database" heading. Just remember what you named it, as you'll need to feed this info back to the your app.
Lead image via Flickr user Michael @ NW Lens.



































