You are here
appel - Wed, 2011/01/12 - 00:15
Excuse me if I overlooked the answer to this question. I've searched the forum and the internet, but couldn't find anything on the subject (except for this, but I don't think it answers my question).
I'm running the Turnkey LAMP appliance, works like a charm so far. Is it by any chance possible to mount a folder of the host OS (Windows 7), say c:/Users/localhost and set that as the documentroot?
Thank you very muych in advance!
Forum:
You could do that, although I'd go the other way.
So share a folder on the LAMP appliance using Samba and map it as a network drive on your Windows 7 machine. You could use Samba as a client to go the way you want but IMO it will involve a bit more mucking around.
To share your current docroot (/var/www by default) first install Samba (and the Samba Webmin module):
Off the top of my head, I reckon the easiest way to go would be to add a new Linux user and add them to the www-data (webserver) user group. Set the new user's home as /var/www AFAIK permissions will default to 755 (which should be ok) but depending on your web content you may wish to change this (or if I'm wrong). So permissions can be set for that folder to 755 (or 744 even if only html is to be used, or if your site requires write access then go 775 or 774 - google found me this great Linux file permissions explaination here). You can do this via an SFTP client (such as Filezilla) or through Webmin (File Manager >> Info) or at the command line:
Then sync the new Linux user as a Samba user (Samba keeps its own user list - keep the name the same to avoid confusion). Now share /var/www (I use the Samba Webmin interface, it's fairly straightforward). You won't need to worry about file permissions as we've handled that earlier. Once you're finished restart samba on your appliance. If you want more info about Samba have a look at the Ubuntu documentation here.
Now on your Windows host browse to the share you just created in a Explorer window you will want something like this:
It will ask for your username and password, use the details of the new Linux user you created. Then browse to the folder (it will be the only one shown and if you allow Windows to remember password then you can map this share as a Network drive.
Hey JedMeister, Thank you
Hey JedMeister,
Thank you very much for your clear and detailed answer. Leaving the house in five minutes so I'll have to wait until later before I can try it out.
The reason I want it the other way around is because that way I could keep my Turnkey install (and the *.vdi) clean. I was hoping to keep a backup of my vdi disk in case something goes awry. I could easily restore it, without having to sync any work files. My current localhost contains over 10GB of work files, so that could be somewhat of a hassle. Another reason is that I could have access to my files even when Virtualbox is not running. If you happen to know a way to do this I would love to hear it.
Thanks again for helping me out, really appreciated!
Ok it looks like you'll want smbclient then...
I haven't tested any of this so we may need to tweak some details.
Install smbclient and smbfs like this:
I'm not sure of the exact details but it will basically involve connecting to the file share and then mounting it to the local linux filesystem.
Some config info can be found in the Ubuntu docs here. I haven't read it all but this on Mounting Win Shares permanently may also be useful. You may need to have a play around with it to get it working nicely. FYI it seems there may be some bugs netween Windows Live Essentials and Samba access to Win 7 shares, you may need to uninstall Live Essentials, see this thread on Ubuntu forums. There is also an outdated (but possibly still useful) tutorial on Ubuntu forums here.
Good luck and please document your experience so you can post back with info in case others want to do the same as you.
I got it to work!
After some tinkering it seems like I've got it working and it's actually not that hard to do. I'm now rocking a clean virtual lamp stack with a Document Root that resides on the host OS. It seems to run pretty well!
I'm still working on some of the details - for example, I'd like to move mysql's datadir to the host OS too - but as soon as I'm done I'll post a follow up with the steps needed to get this working.
Thanks JedMeister for getting me started!
No worries
Glad you got it all running. You should be fine moving the database too, but just keep in mind that TKLBAM may need tweaking if you want backups as well. Assuming you mounted your docroot in the usual place then TKLBAM shouldn't even notice the difference.
Which solution worked for you?
I'm interested if you ended up using samba, smbclient and smbfs, or ultimately found a way to use VirtualBox's shared folder feature.
Rik
Here's how I did it.
I looked into using Virtualbox's shared folders feature (as I believe Guest additions are in the repos) but ended up using samba instead simply because I already had a few pointers at hand (here's to you, JedMeister!). I'm not exactly a Linux rocket scientist, so if there's anything I did that can or should be done differently I'd love to hear it!
First order of business was ssh'ing into TKL and installing samba and webmin's smb module (although I ended up not having to use it):
I created a folder on the host OS (Windows 7) to be my Document Root:
and shared it on the network so it would be available like so:
Then I created a mount point in TKL:
and after some trial and error I mounted it with this command:
My next step was to make these changes persistent. I opened /etc/fstab:
and slapped this on the end of the file:
I rebooted to see if that worked and sure enough it did... Great success!
So then I opened Apache's main conf file:
and changed the variable DocumentRoot to reflect the new location:
Add new comment