如何编写vagrant框的shell配置代码来更改不在共享文件夹中的文件?

时间:2016-10-20 10:12:34

标签: shell vagrant

我正在设置一个流浪盒来创建一个django框,我需要在配置shell代码中更改apache2 vhost配置。 如何在shell命令中编辑文件?

1 个答案:

答案 0 :(得分:0)

Most simple is if you can have a copy of the host file configuration that you want to apply to your VM. So on your host machine you have the file and during provisioning you will apply this file on the guest machine.

This can be done using the File Provisioner you will add the following in your Vagrantfile

config.vm.provision "file", source: "path/to/host_conf_file", destination: "/var/path/to/apache/conf/file"