Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using Windows for my development operations but i'm deploying to Debian/Ubuntu based distros. So i thought if i move my development to a linux distro it will be more comfortable.

I'm using XAMPP on windows for apache/mysql servers. It's on my portable hard drive. So, if i'm at home i just open XAMPP control panel and click Start Apache, Start Mysql. It works "drive-letter free". So if my portable hard disk is on D drive on my laptop, my document-root is "/www" regardless of drive letter. XAMPP thinks "well, /www is on the root of the drive which i'm running". And after that, if i go to work and plug-in my hard drive (say, it's G) XAMPP can still work because it search for folder relative to drive root.

So my question is: How can i setup a development environment as easy as the example given above?

Dropbox, Git and cp, mv are not viavle options by the way.

Thanks in advance.

share|improve this question
    
Can you (1) simulate the linux path on Windows, or (2) use symlinks to the correct locations on linux? –  Paul Nov 22 '12 at 12:42
    
I cant understand what you are asking in 1 but i can answer 2: Sure i can symlink /var/www to /media/usb_disk/www but if i install apache2 with "apt-get install apache2" i think it works under "www-data" user but the usb disk is formatted with NTFS and there is no linux style permission mechanism. –  Cnkt Nov 22 '12 at 12:47
    
What level of security do you need in your dev environment? You can mount the usb stick with full access to all local users, which would let apache access the files –  Paul Nov 22 '12 at 12:57
    
i dont need any security but can i show a folder on my usb disk as document-root to apache? and when my usb disk is not plugged-in when i switch on the computer apache will tell thar the folder is inaccessible? –  Cnkt Nov 22 '12 at 12:59

1 Answer 1

up vote 2 down vote accepted

I suggest to configure your linux-apache to have an empty folder as document root. Then you plug in your usb stick as usual, and it gets automounted. With mount you can now override the empty folder with the subfolder of your mounted usbstick:

sudo mount -o bind /media/usbstick/.../document_root /var/www

You can probably also add this somewhere to some automount scripts, but this would be another question.

share|improve this answer
    
This is OK for apache but i also run MySQL as a portable program too. How can i do this in ubuntu? (sync dbs with usb drive) –  Cnkt Nov 22 '12 at 14:31
    
You can do it the same way, as long as you don't have any local DB content. mount totally hides the former content of the target folder. Or you simply run mysqld with the --basedir option. –  Michael Nov 22 '12 at 14:38
    
thanks a lot. i'm accepting your answer :) –  Cnkt Nov 22 '12 at 14:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.