markdown 将现有虚拟机VM与流浪者项目相关联

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 将现有虚拟机VM与流浪者项目相关联相关的知识,希望对你有一定的参考价值。

[Vagrant] Associate an existing virtualbox VM with a project
============================================================

Go into the vagrant project directory, then create a file name id in the right 
place with ther VM UUID:
```
$ cd <vagrant-project-folder> && \
> echo -n \
> `VBoxManage list vms \
>   | grep <vm-short-name> \
>   | sed 's/.*{\(.*\)}[^{]*$/\1/'` \
>   > .vagrant/machines/<vm-short-name>/virtualbox/id
```

*It directly inject whatever between {} in the result line of the grep to the file without newline*

Check if the change was taken into account

```
$ vagrant status \
> | grep -qE '<vm-short-name>.*not created'
```

*If vagrant status return a line with our <vm-short-name> and "not created" 
it means it didn't work, otherwise it's OK*

We can then run vagrant up [<vm-short-name>] to get back our VM

***Note:***

- *If the project only have one VM then <vm-short-name> should be equal to <default>*
- *tested with vagrant 1.8.1 and virtualbox 5.0.20 r106931*

***Sources:***

- [stackoverflow/9434313][1]

[1]: https://stackoverflow.com/questions/9434313/how-do-i-associate-a-vagrant-project-directory-with-an-existing-virtualbox-vm

以上是关于markdown 将现有虚拟机VM与流浪者项目相关联的主要内容,如果未能解决你的问题,请参考以下文章

markdown 流浪虚拟机访问主机端口

流浪者没有启动。创建 VM 的用户与当前用户不匹配

微软云azure虚拟机,我是否可以将现有 VM 添加到可用性集

VM虚拟机?

软件虚拟机保护分析资料整理

如何更改现有流浪盒的配置?