Tutorial :: How to have shared HTDOCS between dual boot system

Updated Squidge 5 Tallied Votes 823 Views Share

I googled and googled to try and find a comprehensive wiki/tut on how to share htdocs across a dual platform.

My base install is Windows 7 64bit, and recently (6wks ago) set up a dual boot.
One thing pained me for a while of not being able to use the current edited files from one system to the other.

So for anyone that is looking to do this, I finally sussed it and have it working :).

Assumptions:
1. You have XAMPP installed on Windws platform
2. You have XAMPP installed on Linux platform
3. You know how to access Terminal in Linux

All text ->

Like this is in terminal

So, first things first we need to modify the way Linux mounts the additional drives/partitions.

Firstly unmount the Windows drive.

This is done using the fstab file. So before we make changes make a back up.

sudo cp /etc/fstab /etc/fstab_orig

We also need to get the UUID of our other drive (Windows drive) using blkid:

sudo blkid

/dev/sda1: LABEL="SYSTEM" UUID="9EC0347FC0346027" TYPE="ntfs" 
/dev/sda2: LABEL="OS" UUID="E868357B68354998" TYPE="ntfs" 
/dev/sdb1: UUID="4659932c-47e6-431b-8bda-779a3e2efb18" TYPE="ext4" 
/dev/sdb5: UUID="8170f6c2-aa22-4b9b-9480-8231665ff232" TYPE="swap" 
/dev/sdb6: UUID="783cc8a0-24c3-44cd-9c61-01d51d047099" TYPE="ext4" 
/dev/sdb7: UUID="26a38c59-f39c-47eb-b9aa-b15f4355951f" TYPE="ext4" 
/dev/sr0: LABEL="Disk1" TYPE="udf" 
/dev/sdc1: LABEL="WebDesign" UUID="18C47AFBC47ADB08" TYPE="ntfs" 

This will give you output of the UUIDs in use matching the HDDs. Make a note of the long alphanumeric UUID that corresponds to your Windows drive. Then using the editor of your choice (Iam using gedit in this), we are going to tag a line on the very end

sudo gedit /etc/fstab

# Windows C: partition
    UUID=E868357B68354998  /media/OS  ntfs user,rw,nosuid,nodev,uid=33    0    0

Save and exit

What this does is mounts the drive as a writable directory -> /media/OS <- change this to what ever you want, but it MUST exist.

Now force mount using the below, or reboot

sudo mount -a

This now gives you full access. Now you need to rename the existing htdocs (still in the Linux platform).
(path is the one used in XAMPP installation how to)

sudo mv /opt/lamp/htdocs/ /opt/lamp/htdocs_old/

Or you can delete if you so wish, but i would suggest the deletion is done at the very end.

Ok, so at this point we have a fully mounted NTFS Windows drive, and no working htdocs. Now we create a symlink from the Windows htdocs:

sudo ln -s /media/OS/[path]/[to]/[htdocs] /opt/lamp/

So for example if my XAMPP install is in the root of C: under Windows, and mounted under Linux as /media/OS/:

sudo ln -s /media/OS/xampp/htdocs/ /opt/lamp/

This creates the link between the system. Start XAMPP under Linux and goto http://localhost.

sudo /opt/lamp/lamp start

You get a 403 error, this is because Apache is not able to read through the links, so we need to modify another file, but first, stop XAMPP

sudo /opt/lamp/lamp stop

-------------------------
So to give Apache the folder location, so we edit the following:

sudo gedit /opt/lamp/etc/http.conf

Key search for the following lines:

DocumentRoot "/opt/lampp/htdocs"
<Directory "/opt/lampp/htdocs">

Put a hash in front of these, and insert the following:

DocumentRoot "/media/OS/xampp/htdocs"
<Directory "/media/OS/xampp/htdocs"

>

In my file it looks like this:

## old value -> DocumentRoot "/opt/lampp/htdocs"
## old value -> <Directory "/opt/lampp/htdocs">
DocumentRoot "/media/OS/xampp/htdocs"
<Directory "/media/OS/xampp/htdocs">

Save and exit

Now start up XAMPP and no more 403 error.

pritaeas commented: Nice one. +14
diafol commented: Nice to know +14
cereal commented: thanks for sharing! +11
LastMitch commented: Nice Work! +11
masterjiraya -3 Junior Poster

wow. nice one mr. Squidge. I hope there will be forum here like lesson sharing hahahah. thnx. Just found what I need now.

Squidge 101 Newbie Poster

@masterjiraya,

Your welcome. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.