How do I install apache
, php
, and mysql
on a usb flash drive in ubuntu? I know you can do it on windows, but I'd like to be able to run it from a linux operating system.

- 14,916

- 21
2 Answers
The only way you can achieve this is if your entire Ubuntu OS is installed on a flash drive. The packages you want to install integrate themselves into your OS as they require common packages to function correctly. You could change the path of your apache directory for example so that your websites reside on your usb if you like: Easy way to change apache www location
If you want to install Ubuntu on a usb have a look at this link: Can I install Ubuntu to my 32 GB USB pen drive?
There is XAMPP for Linux, but I'm still a bot unsure if it can be installed to a USB drive. Grepping trough XAMPP for Linux it becomes apparent that everything is hardwired to the /opt/lamp/ folder. The XAMPP installer will copy everything in this /opt/lamp/ and doesn't give you an alternative.
So if someone would move this folder to a USB-Stick, one would need to create a softlink cd /opt; ln -s /media/Enter-Label-of-USB-Stick/lamp
back to this place.
And you would need to do this on every PC where this stick is supposed to be used.
Note: Answer is untried and somewhat incomplete.

- 4,244
- 8
- 28
- 50