Debian virtual machines created by VirtualBox share files with Windows hosts

  • 2021-01-25 08:10:43
  • OfStack

Terms:

VM: Virtual machine

Steps:

1, download and install on Windows10 VirtualBox6. 0.8 (time: 2019/5/30), download address: https: / / download virtualbox. org/virtualbox / 6.0.8 / VirtualBox 6.0.8-130520 - Win. exe

Or https: / / www. virtualbox. org/wiki/Downloads an alternate version;

2. Start VirtualBox and create Debian and VM;

3, Download the system installation image from the Debian site, right-click the ISO image file, select "Load", insert it into the virtual drive ready to "play", the virtual drive's disk character is assumed to be "H" (this is the H disk),

Download address: https: / / cdimage debian. org/debian - cd/current/amd64 / iso - cd/debian - 9.9.0 - amd64 - netinst. iso or https: / / www debian. org/distrib/netinst an alternate version;

Note: if there is no "load" option, please install floppy disk first

4. Select the VM created in Step 2 from the VM list on the left side of the VirtualBox window, click the Setup button (1 big gear) on the upper toolbar, open the Setup interface, click the "Save" option on the left, and add a new disc for VM, which corresponds to the H disk.

5. Click the Run button (1 large arrow) on the toolbar above the VirtualBox window to start VM and finally start and run the Debian installer from the H disk. After the installation of the system is complete, restart the system and enter Debian;

6. Enter root, enter the password set when installing the system, and log in to the system;

Note: During the process of typing the password, there will be no corresponding output on the screen. This is normal and everyone understands the purpose.

8, type apt install linux-headers-$(uname -r) Enter and install linux headers; Type shutdown enter and wait for the shutdown.

9. According to Step 4, delete the disk corresponding to H and add a new disk. The disk corresponds to VBoxGuestAdditions.iso file in the VirtualBox installation directory (the path on 64-bit operating system is: C: Program Files\Oracle\VirtualBox; The path may be different for 32-bit operating systems.

10. Refer to Steps 5 and 6 to boot up the system again and type mkdir /mnt/vboxadd. Enter and type mount /dev/cdrom /mnt/vboxadd Press enter to mount the contents of VBoxGuestAdditions.iso in /mnt/vboxadd directory;

11, type cd /mnt/vboxadd Press enter to enter the directory;

12, type sh VBoxLinuxAdditions.run --nox11 Enter to enable debian to recognize vboxsf file type; Type shutdown enter and wait for the shutdown.

13, Follow step 4 to find the option of sharing files, select 1 folder (e.g. c:\shareF) and set the fixed share, set the share name (e.g. shareF), and leave the other options blank.

14. Refer to Steps 5 and 6 to boot up the login system again and type in mkdir  shareFromWin Enter, type mount -t vboxsf shareF shareFromWin Enter;

Done!

c:\shareF Create a new text file in c:\shareF, it can also be seen in Debian /root/shareFromWin, or vice versa.

conclusion


Related articles: