Page 1 of 1

Portable lampp on a thumbdrive?

PostPosted: 14. July 2010 16:11
by rogue780
I want to be able to maintain an entire lampp stack on a thumbdrive so I can go between different boxes and do development work. This is possible with the windows version, but it seems rather difficult with the linux version. How do I go about doing this?

Also, if there is a way to have both a linux and a windows lampp stack share a mysql database that would be great. The database for this project is very large and it's a pain in the rear to synchronize it whenever there is a structural change.

Thanks so much!

Re: Portable lampp on a thumbdrive?

PostPosted: 14. July 2010 16:42
by Nobbie
rogue780 wrote:How do I go about doing this?


a) Unpack the Xampp Tar Package on to USB drive (let's call it /media/usb), which results in an installation of Xampp in /media/usb/lampp.

b) whenever you unplug and plub your USB stick, it will be mounted to /media/usb (or whatever you choose). At next step, create a symbolic link from /media/usb/lampp to /opt/lampp

Code: Select all
sudo ln -s /media/usb/lampp /opt/lampp


This link step is most important, as lampp only runs from /opt/lampp on Linux!


c) finally start lampp as usual by typing

Code: Select all
sudo /opt/lampp/lampp start


rogue780 wrote:Also, if there is a way to have both a linux and a windows lampp stack share a mysql database that would be great.


There is no problem about that. The "datadir" directive of MySQL (either in my.cnf or a command line parameter to mysqld, the mysql server) determines the folder where the databases are stored. Simply provide the appropriate value to datadir, depending on the OS which you are currently running. The command line option overrides the directives of the my.cnf file.

The Linux pathname of the MySQL database may look like /opt/lampp/var/mysql (or similar - I dont remember exactly; dont forget - the USB stick is linked to /opt/lampp via symbolic link) and the Windows Pathname for MySQL might look like U:/lampp/var/mysql (this is the Windows Pathname for the Linux MySQL Data Folder). You must put as well the Windows Xampp as well as the Linux Xampp onto the stick (for the binary executables), but simply use only one of the two MySQL Data Folders for both "views". In a fresh installed environment, the databases are identically.

You may as well share the DocumentRoots (same logic). Only the binaries (httpd.exe, DLLs etc.) are different between WIndows and Linux.

Re: Portable lampp on a thumbdrive?

PostPosted: 15. July 2010 19:19
by SMOwais
Nobbie wrote:At next step, create a symbolic link from /media/usb/lampp to /opt/lampp
Code: Select all
sudo ln -s /media/usb/lampp /opt/lampp

This link step is most important, as lampp only runs from /opt/lampp on Linux!
c) finally start lampp as usual by typing
Code: Select all
sudo /opt/lampp/lampp start



Nobbie, I followed the same steps but MySQL failed to start.
Code: Select all
$ sudo /opt/lampp/lampp start
Starting XAMPP for Linux 1.7.3a...
XAMPP: Starting Apache with SSL (and PHP5)...
XAMPP: Starting MySQL...
XAMPP: Couldn't start MySQL!
XAMPP: Starting ProFTPD...
XAMPP for Linux started.


and when I tried to start the panel, I got the following error:
Code: Select all
$ sudo /opt/lampp/lampp panel
Traceback (most recent call last):
  File "xampp-control-panel.py", line 18, in <module>
    import gtk
  File "/usr/lib/python2.5/site-packages/gtk-2.0/gtk/__init__.py", line 48, in <module>
    from gtk import _gtk
ImportError: /usr/lib/libfontconfig.so.1: undefined symbol: FT_Select_Size


Please guide me, how can I fix this error.
Thanks for your time.

Re: Portable lampp on a thumbdrive?

PostPosted: 16. July 2010 02:49
by rogue780
This isn't working for me. When I try to extract to my thumbdrive, it complains that it can't create several symlinks, and then once that's done and i try and start lampp, only proftpd is able to start.

Re: Portable lampp on a thumbdrive?

PostPosted: 18. July 2010 13:50
by Nobbie
>When I try to extract to my thumbdrive, it complains that it can't create several symlinks

Symlinks do only work on UNIX File systems. Therefore you must not use FAT32 on your USB stick, but extfs2 (or similar). If you like to install also the windows Xampp version, you previously have to divide the USB stick into partitions (at least two). One has to be formatted as FAT32 (Windows) and the other as said before.

As Windows usually cannot access different USB partitions than the first, you must use FAT32 for the first partition and extfs2 for the second. Unix can access all partitions without any problems.

>Please guide me, how can I fix this error.

I guess, the USB stick is not mounted with the appropriate permissions. The MySQL Data Folder must have certain permissions (simply do a local install on a Linux machine and watch the permissions of the folders). The permissions of the USB stick depend on the mount command. You have to apply suffient rights in the /etc/ftab file.

You see, you need some basic Linux knowledge about that, hopefully you know how to do it. Otherwise proceed to a Linux forum and/or read some tutorials about Linux and the mount command (and about the permissions in Linux).

Re: Portable lampp on a thumbdrive?

PostPosted: 22. December 2010 10:54
by TAXI
Here's a little shell script for starting lampp out of a pendrive (needs gksu if not started as root):
Code: Select all
#!/bin/bash
if [ "$(whoami)" != "root" ];
then
  echo "Not root! Calling gksu"
  gksu "$0"
else
  echo "Linking..."
  cd $(dirname $0)
  ln -s $(pwd)/lampp /opt/lampp
  echo "Starting Panel..."
  python /opt/lampp/share/xampp-control-panel/xampp-control-panel.py
  echo "Unlinking..."
  rm /opt/lampp
  echo "Good Bye"
fi

Simply save this in your pendirve (for example: /media/pendrive/lampp.sh). The lampp folder has to be there, too (for example: /media/pendrive/lampp).
P.S. Improvements wanted! :)

//EDIT: script changed.
//EDIT²: bug fixed.