Homestead / Vagrant - 没有已安装的文件夹

时间:2016-02-12 15:31:48

标签: laravel vagrant

我正试图为我的laravel项目获得Homestead VM设置。我已完全按照说明here 。唯一的区别是我把Homestead目录放在的文件夹中;我只是把它放在C:/。

否则我已经设置了Vagrant框,克隆并插入了Homestead,并完全按照指示设置homestead.yaml文件。然后我用vagrant ssh启动VM。当我使用ls查看映射目录中的文件夹时 - 没有。

这是我的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

当我运行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

如您所见,最后两行似乎安装在错误的文件夹中,即Vagrant机器正在启动的文件夹。但是,检查Virtualbox会显示此。在.yaml文件中指定的文件夹都已设置并映射。

是什么给出了?

1 个答案:

答案 0 :(得分:0)

/vagrant默认安装在Vagrantfile所在的项目中。

我不确定是否可以直接从homestead.yaml文件中禁用它,但您可以编辑Vagrantfile并添加

config.vm.synced_folder ".", "/vagrant", disabled: true

所以它不会在VM中创建/vagrant目录,而VirtualBox只显示从yaml指定的文件夹。