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.

My setup

enter image description here

I want to setup a ubuntu vm to act as a web server for development.

Reason

I want to have a development environment as close to the actual production environment as possible.

Problem

The above setup failed. I keep getting a File Not Found when I navigate to http://project1.localhost:8888

What I tried

I did add www-data to the group vboxsf using

sudo adduser www-data vboxsf

before trying any of the below.

  1. As mentioned, I tried the above setup. File not found error on webpage.
  2. I tried the above setup but symlink from /var/virtual/project1 to /media/sf_WebApps/project1. File not found error on webpage.
  3. I tried to chown the /media/sf_WebApps from root:vboxsf to www-data:vboxsf. Not possible.
  4. I tried to chmod the /media/sf_WebApps to 755. Not possible.
  5. I made a copy of /media/sf_WebApps/project1 and place the copy inside /var/virtual. This works, but this is not what I want. Why not? Because I want to easily use my host programs like github mac app and sublime text editor to make changes to the code base and see it reflected when I visit on browser.
share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

The answer is found here from serverfault.

Basically, you need to mount the (already mounted) shared folder as another user.

Type

mount -t vboxsf SHARE_NAME -o rw,dmode=777,gid=GROUP_ID,uid=USER_ID /path/on/guest

In this case, it will be

mount -t vboxsf WebApps -o rw,dmode=777,gid=GROUP_ID,uid=USER_ID /var/virtual/some_folder_name

If you want to do this mount every time you turn on the guest OS, create a file on /etc/init/SOMETHING.conf, with something like this:

description     "SOME DESCRIPTION"

start on starting

task
exec mount -t vboxsf WebApps -o rw,dmode=777,gid=GROUP_ID,uid=USER_ID /var/virtual/some_folder_name

To find out what is your uid or gid

 id -u username
 id -g username

Troubleshooting:

Always remember to first create the mount point first.

Always remember to install the GuestAdditions first. You can refer to http://docs-v1.vagrantup.com/v1/docs/base_boxes.html under Install Guest Additions.

sudo apt-get install linux-headers-$(uname -r) build-essential
sudo apt-get install dkms -y

sudo mount /dev/cdrom /media/cdrom
sudo sh /media/cdrom/VBoxLinuxAdditions.run
share|improve this answer
add comment

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.