[英]Homestead/Vagrant - no mounted folders
I'm trying to get a Homestead VM setup for my laravel project. 我正在尝试为我的laravel项目安装Homestead VM。 I have followed the instructions here exactly .
我完全按照这里的指示进行操作。 The only difference is the folder I put the Homestead directory in;
唯一的区别是我将Homestead目录放在其中的文件夹中。 I simply put it in C:/.
我只是把它放在C:/中。
Otherwise I have set up the Vagrant box, cloned and inited Homestead, and set up the homestead.yaml
file exactly as instructed. 否则,我将设置“ Vagrant”框,克隆并初始化Homestead,并完全按照指示设置
homestead.yaml
文件。 I then start the VM with vagrant ssh
. 然后,我使用
vagrant ssh
启动虚拟机。 When I use ls
to view the folders in the mapped directory - nothing. 当我使用
ls
查看映射目录中的文件夹时,什么也没有。
This is my homestead.yaml file: 这是我的homestead.yaml文件:
p: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/ssh/id_rsa.pub
keys:
- ~/ssh/id_rsa.pub
folders:
- map: c:/laravelprojects
to: /home/vagrant/Code
sites:
- map: app.dev
to: /home/vagrant/Code/username/public
databases:
- homestead
When I run vagrant up
, this is the output: 当我运行
vagrant up
,这是输出:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Setting the name of the VM: homestead-7
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 80 (guest) => 8000 (host) (adapter 1)
default: 443 (guest) => 44300 (host) (adapter 1)
default: 3306 (guest) => 33060 (host) (adapter 1)
default: 5432 (guest) => 54320 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Remote connection disconnect. Retrying...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => C:/Homestead
As you can see, the last two lines seem to be mounted the wrong folder, ie the folder the Vagrant machine is being started from. 如您所见,最后两行似乎安装在错误的文件夹中,即启动Vagrant机器的文件夹。 However, checking in Virtualbox shows that both this and the folder specified in the .yaml file are set and mapped.
然而,在VirtualBox中检查表明,这并在.yaml文件中指定的文件夹都被设置和映射。
What gives? 是什么赋予了?
/vagrant
is mounted by default from the project where Vagrantfile is. 默认情况下,
/vagrant
是从Vagrantfile所在的项目装入的。
I am not sure if it can be disable from homestead.yaml file directly, but you can edit the Vagrantfile and add 我不确定是否可以直接从homestead.yaml文件中禁用它,但是您可以编辑Vagrantfile并添加
config.vm.synced_folder ".", "/vagrant", disabled: true
so it will not create a /vagrant
directory in the VM and VirtualBox will show only your folder specified from the yaml. 因此它不会在VM中创建
/vagrant
目录,VirtualBox将仅显示从yaml指定的文件夹。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.