Forked from estorgio/Mounting VirtualBox shared folders on Ubuntu Server 18.04 LTS (Bionic Beaver).md
Created
March 19, 2021 01:19
-
-
Save anlexN/5b53ff02bb732934e4f8b38d0f328b7f to your computer and use it in GitHub Desktop.
Revisions
-
estorgio revised this gist
Jul 28, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,7 +27,7 @@ But if you want to do it the way I did then please feel free to use my setup abo  - On **Add Share** prompt, select the **Folder Path** in your host that you want to be accessible inside your VM. Type `shared` for the **Folder Name**. Make sure that **Read-only** and **Auto-mount** are unchecked and **Mount point** is blank. Then click **OK**.  -
estorgio revised this gist
Jul 28, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -111,7 +111,7 @@ How to point apache's web directory to our folder in the host. *Note: This setup works fine with Windows hosts. But if you are using Linux or Mac as the host then you may have to set appropriate file permissions on your host directory with chmod in order to make it work.* ## Still not working? If you've followed the steps above and it still doesn't work, please let me know by posting a comment below. Please use the following format and be sure to be as detailed as possible so that I can have enough information to help you out. ``` VirtualBox version: <insert VirtualBox version here> Host: <OS name> <version> -
estorgio revised this gist
Jul 28, 2019 . 1 changed file with 12 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -98,7 +98,7 @@ This directory mount we just made is temporary and it will disappear on next reb If it is then congratulations! You successfully linked the directory within your VM with your host folder. ## Bonus: Using shared folders as Apache root directory How to point apache's web directory to our folder in the host. - Remove apache's old `html` directory (WARNING! Backup your data if necessary) ``` @@ -108,4 +108,14 @@ How to point apache's web directory to our folder in the host. ``` sudo ln -s ~/shared /var/www/html ``` *Note: This setup works fine with Windows hosts. But if you are using Linux or Mac as the host then you may have to set appropriate file permissions on your host directory with chmod in order to make it work.* ## Still not working? If you've followed the steps above and it still doesn't work, please let me know by posting your comments below. Please use the following format and be sure to be as detailed as possible so that I can have enough information to help you out. ``` VirtualBox version: <insert VirtualBox version here> Host: <OS name> <version> Guest: <OS name> <version> Description: <detailed description of the problem> ``` Do note that I'm mostly a Windows user and I'm not that well versed with Linux but I will do my best to help you out. -
estorgio revised this gist
Jul 28, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ This guide will walk you through the steps on how to setup a VirtualBox shared f ## Prerequisites This guide assumes that you are using the following setup: - [Oracle VM VirtualBox version 6.0.10](https://download.virtualbox.org/virtualbox/6.0.10/VirtualBox-6.0.10-132072-Win.exe) with [Extension Pack](https://download.virtualbox.org/virtualbox/6.0.10/Oracle_VM_VirtualBox_Extension_Pack-6.0.10.vbox-extpack) installed - Microsoft Windows 7 SP1 as the host OS - A fresh install of [Ubuntu Server 18.04.2 LTS](https://ubuntu.com/download/server/thank-you?version=18.04.2&architecture=amd64) as the guest OS -
estorgio revised this gist
Jul 28, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ This guide will walk you through the steps on how to setup a VirtualBox shared f This guide assumes that you are using the following setup: - Oracle VM VirtualBox version 6.0.10 - Microsoft Windows 7 SP1 as the host OS - A fresh install of [Ubuntu Server 18.04.2 LTS](https://ubuntu.com/download/server/thank-you?version=18.04.2&architecture=amd64) as the guest OS You could still make this guide work with other setups (possibly with some modifications to the commands and whatnot). But if you want to do it the way I did then please feel free to use my setup above. -
estorgio revised this gist
Jul 28, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -35,7 +35,7 @@ But if you want to do it the way I did then please feel free to use my setup abo  - Once your VM is up and running, go to **Devices** -> **Insert Guest Additions CD image**  -
estorgio revised this gist
Jul 28, 2019 . 1 changed file with 4 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -92,11 +92,10 @@ This directory mount we just made is temporary and it will disappear on next reb ``` sudo shutdown -r now ``` - Go to your home directory and check to see if the directory is highlighted in green.  If it is then congratulations! You successfully linked the directory within your VM with your host folder. ## Bonus -
estorgio revised this gist
Jul 28, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -76,7 +76,7 @@ This directory mount we just made is temporary and it will disappear on next reb ``` sudo nano /etc/fstab ``` - Add the following line to `fstab` (separated by tabs). Make sure to replace `<username>` with your username. Save the file. ``` shared /home/<username>/shared vboxsf defaults 0 0 ``` -
estorgio revised this gist
Jul 28, 2019 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -39,17 +39,17 @@ But if you want to do it the way I did then please feel free to use my setup abo  - Use the following command to mount the CD ``` sudo mkdir /media/cdrom sudo mount -t iso9660 /dev/cdrom /media/cdrom ``` - Install dependencies for VirtualBox guest additions ``` sudo apt-get update sudo apt-get install -y build-essential linux-headers-`uname -r` ``` - Run the installation script for the guest additions. Wait until the installation completes. ``` sudo /media/cdrom/./VBoxLinuxAdditions.run ``` -
estorgio revised this gist
Jul 28, 2019 . 1 changed file with 15 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,19 +12,33 @@ But if you want to do it the way I did then please feel free to use my setup abo ## Initial Steps - Open VirtualBox  - Right-click your VM, then click **Settings**  - Go to **Shared Folders** section  - Add a new shared folder  - On **Add Share** prompt, select the **Folder Path** in your host that you want to be accessible inside your VM. Make sure that **Read-only** and **Auto-mount** are unchecked. Leave **Mount point** blank. Then click **OK**.  - Start your VM  - Once your VM is up and running, go to **Devices** menu -> **Insert Guest Additions CD image menu**  - Use the following command to mount the CD: ``` sudo mkdir /media/cdrom -
estorgio revised this gist
Jul 28, 2019 . 1 changed file with 8 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,14 +12,19 @@ But if you want to do it the way I did then please feel free to use my setup abo ## Initial Steps - Open VirtualBox  - Right-click your VM, then click **Settings**  - Go to **Shared Folders** section  - Add a new shared folder  - On **Add Share** prompt, select the **Folder Path** in your host that you want to be accessible inside your VM. Make sure that **Read-only** and **Auto-mount** are unchecked. Leave **Mount point** blank. Then click **OK**.  - Start your VM  - Once your VM is up and running, go to **Devices** menu -> **Insert Guest Additions CD image menu**  - Use the following command to mount the CD: ``` sudo mkdir /media/cdrom -
estorgio revised this gist
Jul 28, 2019 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,11 +38,11 @@ But if you want to do it the way I did then please feel free to use my setup abo ``` sudo shutdown -r now ``` - Create `shared` directory in your home ``` mkdir ~/shared ``` - Mount the shared folder from the host to your `~/shared` directory ``` sudo mount -t vboxsf shared ~/shared ``` @@ -53,23 +53,23 @@ But if you want to do it the way I did then please feel free to use my setup abo ## Make the mount folder persistent This directory mount we just made is temporary and it will disappear on next reboot. To make this permanent, we'll set it so that it will mount our `~/shared` directory on system startup - Edit `fstab` file in `/etc` directory ``` sudo nano /etc/fstab ``` - Add the following line to `fstab` (separated by tabs) and press `Ctrl+O` to save. ``` shared /home/<username>/shared vboxsf defaults 0 0 ``` - Edit `modules` ``` sudo nano /etc/modules ``` - Add the following line to `/etc/modules` and save ``` vboxsf ``` - Reboot the VM and log-in again ``` sudo shutdown -r now ``` @@ -78,7 +78,7 @@ This directory mount we just made is temporary and it will disappear on next reb cd ~ ls ``` If it is then congratulations! You successfully linked the directory within your VM with your host folder. ## Bonus How to point apache's web directory to our folder in the host. @@ -90,4 +90,4 @@ How to point apache's web directory to our folder in the host. ``` sudo ln -s ~/shared /var/www/html ``` *Note: This setup works fine with Windows hosts. But if you are using Linux or Mac as the host then you may have to set appropriate file permissions on your host directory with chmod in order to make it work.* -
estorgio revised this gist
Jul 28, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,7 @@ This guide assumes that you are using the following setup: - Oracle VM VirtualBox version 6.0.10 - Microsoft Windows 7 SP1 as the host OS - A fresh install of Ubuntu Server 18.04.2 LTS as the guest OS You could still make this guide work with other setups (possibly with some modifications to the commands and whatnot). But if you want to do it the way I did then please feel free to use my setup above. -
estorgio revised this gist
Jul 28, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -89,4 +89,4 @@ How to point apache's web directory to our folder in the host. ``` sudo ln -s ~/shared /var/www/html ``` *Note: This setup works fine with Windows hosts. But if your using Linux or Mac you may have to set the appropriate file permissions on your directory with chmod in order to make it work.* -
estorgio created this gist
Jul 28, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,92 @@ # Mounting VirtualBox shared folders on Ubuntu Server 18.04 LTS (Bionic Beaver) This guide will walk you through the steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest. ## Prerequisites This guide assumes that you are using the following setup: - Oracle VM VirtualBox version 6.0.10 - Microsoft Windows 7 SP1 as the host OS - A fresh install of Ubuntu Server 18.04.2 LTS as the guest OS You could still make this guide work with other setups (possibly with some modifications to the commands and whatnot). But if you want to do it the way I did then please feel free to use my setup above. ## Initial Steps - Open VirtualBox - Right-click your VM, then click **Settings** - Go to **Shared Folders** section - Add a new shared folder - On **Add Share** prompt, select the **Folder Path** in your host that you want to be accessible inside your VM. - In the **Folder Name** field, type `shared` - Uncheck **Read-only** and **Auto-mount**, and check **Make Permanent** - Start your VM - Once your VM is up and running, go to **Devices** menu -> **Insert Guest Additions CD image menu** - Use the following command to mount the CD: ``` sudo mkdir /media/cdrom sudo mount -t iso9660 /dev/cdrom /media/cdrom ``` - Install dependencies for VirtualBox guest additions: ``` sudo apt-get update sudo apt-get install -y build-essential linux-headers-`uname -r` ``` - Run installation script for the guest additions: ``` sudo /media/cdrom/./VBoxLinuxAdditions.run ``` - Reboot VM ``` sudo shutdown -r now ``` - Create "shared" directory in your home ``` mkdir ~/shared ``` - Mount the shared folder from the host to your ~/shared directory ``` sudo mount -t vboxsf shared ~/shared ``` - The host folder should now be accessible inside the VM. ``` cd ~/shared ``` ## Make the mount folder persistent This directory mount we just made is temporary and it will disappear on next reboot. To make this permanent, we'll set it so that it will mount our `~/shared` directory on system startup - Edit fstab file in /etc directory ``` sudo nano /etc/fstab ``` - Add the following line to fstab (separated by tabs) and press Ctrl+O to Save. ``` shared /home/<username>/shared vboxsf defaults 0 0 ``` - Edit modules ``` sudo nano /etc/modules ``` - Add the following line to `/etc/modules` and save ``` vboxsf ``` - Reboot the vm and log-in again ``` sudo shutdown -r now ``` - Go to your home directory and check to see if the file is highlighted in green. ``` cd ~ ls ``` If it is then congratulations! You successfully linked the directory within your vm with your host folder. ## Bonus How to point apache's web directory to our folder in the host. - Remove apache's old `html` directory (WARNING! Backup your data if necessary) ``` sudo rm -rf /var/www/html ``` - Add a symbolic link in its place ``` sudo ln -s ~/shared /var/www/html ``` *Note: This setup works fine with Windows hosts. But if your using Linux or Mac you may have to set the appropriate file permissions on you directory with chmod in order to make it work.*