Friday, June 13, 2008

Portable applications running from a USB drive

One of the things I’ve always wanted to investigate is having a bunch of applications on a USB drive that I can just plug in and use anywhere. This weekend I sat down and really had a good look at it.

I went to Portable Apps.com and downloaded the application suite and platform. I installed everything into a folder, aptly named – USB and then tried out the various applications to see how they worked.

I was very impressed. Pretty much everything worked fine. The things that needed a bit of work were XAMPP, and Base. (I’ll explain a bit about them later.)

Then I copied the contents of the USB folder onto a 1gig USB drive. It took up about 600mb with all the extra apps I had installed. Then I plugged the drive into my laptop and away I went. All the programs worked fine. This is exactly what I was looking for!!

So what do you get? Quite a lot really.
  • Firefox – web browser
  • Thunderbird – email client
  • Sunbird – calendar
  • ClamWin – anti-virus
  • Pidgin – instant messenger
  • Sumatra – a PDF reader
  • KeePass – a password manager
  • Sudoku – game
  • Mines – game
  • CoolPlayer – an audio player
  • OpenOfiice – an office application suite
  • Writer – word processor
  • Calc – spreadsheet
  • Impress – presentation application (like PowerPoint)
  • Draw – a drawing program
  • Base – a database application like Access

I also added:
  • FileZilla – FPT client
  • GIMP – graphics manipulation application
  • Notepad++ - text editor that does syntax highlighting
  • VLC Media Player – media player for music and video
  • XAMPP – a web-server suite including:
  • Apache2
  • MySQL5
  • PHP5

As I said, for the most part the apps work great. When you plug the USB drive in, if you’ve got the autorun enabled you’ll get the usual window popping up asking you what you want to do. Running the StartPortableApps.exe should appear as the selected option. If not you can navigate to the .exe file and double click it to start the apps menu.

Then you just choose the apps you want to run from the menu. Easy really.

You can surf the web, create documents etc and save them all on the USB drive. When you get home, to work, wherever you can just plug the drive in and access all your files no problem. If you want to copy and paste them to your hard drive, that’s just a normal operation as you would from any removable drive. So there are no nasty hooks that say you can only access the files using the applications on the drive.

Ok so onto the problems I encountered, and their solutions.

Firstly Base, the database utility.

This needs a Java runtime environment which is not part of the download. But no problem. Just go to Sun.com and download the latest JRE. Then put it into the \PortableApps\OpenOfficePortable\App\Java folder and you’re sweet.

Setting up XAMPP took a bit more work.

The main problem is that when you first install it the directory paths are put in as absolute URLs. This works fine until you try to move to a different machine.

So after you install it go to the following files and change the paths as described below. Then it should work fine.

For Apache web server



\PortableApps\xampp\apache\conf\httpd.conf

All the files in the \PortableApps\xampp\apache\conf\extra folder

Find all the places where the URLs are expressed, e.g.

ServerRoot "C:/USB/PortableApps/xampp/apache"

And change it to:

ServerRoot "/PortableApps/xampp/apache"

There are quite a few of them.

This will make it insert the drive letter that corresponds to the location of the apache .exe file, effectively mapping the URLs to use the drive letter assigned to the USB drive.

PHP


Look in the php.ini file in \PortableApps\xampp\apache\bin and remove the drive letter in the URLs for importing packages etc.

MySQL – database sever

This one too uses absolute URLs in the \PortableApps\xampp\mysql\bin\my file.

The only way I could find to edit this file was to open Notepad and then drag the file into it.

As before go through and remove the drive letter.

Once you’ve done that try starting the servers using the batch files in \PortableApps\xampp

apache_start.bat to start the webserver, and apache_stop.bat to stop it.

This will inform you of any errors. If it just says Apache is starting and then seems to hang, that’s a good thing.

Open Task Manager and look under the running processes to see if Apache is listed. It will probably be listed twice. If it is in there, then it is running.

Do the same with mysql_start.bat. If it says it is running and waiting for connections then you’re good to go.

If you’ve missed a URL then it will display an error in the command window. Simply go to the file and change the URL so it does not have a drive letter specified.

Open a web browser (try using the portable Firefox) and type 127.0.0.1 or localhost into the address bar. You should get the XAMPP welcome page. Click on the phpinfo() link to see the settings for PHP. Click on the CD Collection link to check that the database is working. If you get three records displayed, then it is working fine.

If found that clicking on the XAMPP_start menu item in the Portable Apps menu sometimes seemed to take quite a while to start things up, so be a little paitent.

One other problem I encountered is if you already have Apache (or another webserver) running or you’ve got MySQL running, then the portable apps won’t work. So the solution is to make sure the other apps are not running. Check in the processes list in the Task Manager to make sure they are not running before you start your portable webserver.

The possibilities for this are endless!!

My next task is to get my MySQL Interface software (that I wrote) and port it to run in the Portable Apps environment. It should not be too difficult to do given that it is a Java app the does not use absolute URLs.

Well I hope this has been helpful. I’m off now for a well deserved glass of wine.

1 comment:

Anonymous said...

So now you will have to get it to work from a bootable USB stick!!!