2017. szeptember 16., szombat

CentOS howto II - Shared folders

  1. Install Guest additions on the guest
    1. Prerequisites on the guest OS side:
      1. yum install dkms kernel-devel
      2. yum groupinstall "Development Tools"
    2. and now the additions themselves:
      1. Devices / Insert Guest Additions CD image...
      2. mount /dev/sr0 /mnt
      3. cd /mnt
      4. ./VBoxLinuxAdditions.run
    3. Create a shared folder:
      1. Devices / Shared Folders / Shared folder settings
      2. Add new..
      3. Select "Auto mount" and "Permanent" options
      4. you can find the shared folder in /media/sf_{SHARE_NAME}
  2. Install guest additions on the host
    1. {VBoxManage} setextradata {VM_NAME} VBoxInternal2/SharedFoldersEnableSymlinksCreate/{SHARE_NAME} 1
      1. {VBoxManage} executable (ususally in C:\Program Files\Oracle\VirtualBox)
      2. {VM_NAME} is the name of the VM
      3. {SHARE_NAME} name of the share as in shared folders settings on in /media/sf_{SHARE_NAME}
    2. Run the VM as administrator. Simplest way to get that going is:
        1. In VirtualBox UI, right click on the VM and "Create Desktop shortcut"
        2. Right click on the desktop icon, properties, advanced, check "Run as administrator"
    3. Start the VM
    4. Watcher configuration: The Guest OS have 0 idea about any changes outside of its jurisdiction. In this setup this pretty much makes watching files from the Linux guest side nearly impossible - except if you use polling. This is an example take from my project's browsersync configuration, something similar must work for any other chokidar based frameworks as well.
    var sync = require("browser-sync").create();
    sync.init({
      server: 'dist',
      port: 80,
      watchOptions: {
        usePolling: true
      }
    });

    1 megjegyzés: