You are here
I am using the following setup to test various sites on different computers using a single external disk. This allows me to not only ferry the data around (10 GB) between different computers with very different operating systems, I also decoupled the data from the VMs for easy portability and to keep the VMs small. I have had virtual machines crash, lockup and burn with strange errors, especially when moving them around with tons of data. This way, my data stays safe on my external RAID box and the VMs act as pure application containers. If one dies, I replace with another real easily. This has worked successfully with different Turnkey versions and through various OS upgrades. The steps below take all of 20 minutes from install to application goodness.
- Install Turnkey LAMP, etc using ISO in VirtualBox (4.02, in my case).
- Set networking to Host-only Adapter to create a private network between host and guest. Actually, it's best to set the networking to bridged to get access to the outside world for downloads. Don't type the stuff in parenthesis.
- prompt> ssh root@xxx.xxx.xxx.xxx
- VM shell> apt-get install aptitude (I like to use aptitude)
- VM shell> aptitude install bzip2
- VM shell> aptitude install dkms (http://en.wikipedia.org/wiki/Dynamic_Kernel_Module_Support)
- VM shell> aptitude install build-essential linux-headers-`uname -r` (headers for current kernel)
- VirtualBox Devices menu -> Install Guest Additions...
- VM shell> mkdir /media/cdrom (had to do this for Turnkey 11 due to bug in Ubuntu)
- VM shell> mount /dev/cdrom /media/cdrom (mount VirtualBox iso in /media/cdrom)
- VM shell> cd /media/cdrom
- VM shell> ./VBoxLinuxAdditions.run (ignore error about Window System driver failure)
- Add a shared folder using VirtualBox Devices menu; keep track of Shared Folder name. In my case, I shared a folder from my external SATA disk.
- VM shell> mkdir /var/shares/share_name (replace share_name with actual shared folder name)
- VM shell> mount -t vboxsf share_name /var/shares/share_name (attach share to filesystem in VM at location /var/shares/share_name, ad infinitum)
- From here, it's easy to edit the config files--Apache, etc--to link to the shared folder for a website
- As easy way is to copy the default file in /etc/apache2/sites-available so that its configuation can be used as starting point; delete the 000-default link in /etc/apache2/sites-enabled; create a link to the copy of the default file.
- VM shell> cp /etc/apache2/sites-enabled/default /etc/apache2/sites-enabled/default-x
- VM shell> rm /etc/apache2/sites-enabled/000-default
- VM shell> ln -s /etc/apache2/sites-available/default-x /etc/apache2/sites-enables/000-default
- VM shell> /etc/init.d/apache2 restart
- Step 15 can be automated, but I have found it easier to just type it in after I have plugged in the external disk.
Thanks for sharing :)
I'm sure others may find this useful.
missing linux-header
I didn't even get to that step. I got:
apt-get install linux-header-`uname -r`
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package linux-header-2.6.32-26-generic
Not sure what log I should be checking for errors, but in /lib/modules I have
/2.6.32-26-generic and /2.6.32-30-generic
and neither have a /build or a /source directory.
Typo...
Should be linux-headers-2.6.32-26-generic (not linux-header-...)
Ie:
apt-get install linux-headers-`uname -r`
Doh!!
Thanks.
No worries :)
Happens to the best of us! Hopefully it'll all work ok from here on in.
BTW hope you don't mind but I deleted the other post you put up (with your sources.list) as it wasn't really relevant in the end.
/sbin/mount.vboxsf: mounting failed with the error: No such devi
I had been searching for the solution for:
/sbin/mount.vboxsf: mounting failed with the error: No such device
... and apparently there's a difference between:
apt-get install build-essential linux-headers-`uname -r`
andapt-get install build-essential linux-header-`uname -r`
The former saved me from the error.
In case you'll encounter another error with the word "protocol", just change the folder name in the edit share sectio of the virtualbox, then try the mount command again and you're good to experience relief.
Philippine Yii Framework Users Group
http://bit.ly/PhilYiiUsersGroup
THANK YOU!
David, please update your post to change the "linux-header" vs "linux-headers" for #7 of your guide.
I have been trying off and on for about two months to get this to work, last night I found your post and EVERYTHING WORKS. So happy. Thank you 100x times.
I have taken the liberty of editing David's post
And I have also copy-pasted this to the TKL Docs, under 'Tutorials/How-tos. See here.
Jeremy, There's one little
Jeremy,
There's one little last piece of this I just figured out. The process above works... after following all the steps I can go to the Webmin and change the apache root to the mount I've created (/var/shares/webfolder) but whenver I point apache to this, I get a 500 error.
I checked out the apache log (/var/log/apache2/error.log) and it's saying this is the error:
Unknown: failed to open stream: Permission denied in Unknown on like 0
I had to create a symlink to get the connection to work properly... or more specifically to create a folder that apache had the permissions to read.
ln -s /var/shares/webfolder /var/www/share
Creating the symlink made an apache readable folder, so after doing this I was able to use the webmin to change the document root for my virutal sites to /var/www/share. VICTORY! It works... I can edit and see changes real time.
The one last thing I need... how can I set the Guest Additions folder to auto-mount? Every time I shutdown and restart the appliance I have to run
mount -t vboxsf webfolder /var/shares/webfolder
Is there somehwere I can add this command to for auto-mounting? I know I specifically can not set the share to auto-mount in the VirtualBox interface as this causes permissions problems with the share (or so I've read).
Add new comment