1、下载安装vagrant

2、添加虚拟机,如vagrant add box centos/7,当然你也可以下载到本地来添加。

3、添加完成后在指定文件夹内初始化你刚才安装好的box,如我在/Users/zhangwei/Vagrant/centos7下执行命令:vagrant init centos/7,这时候会生成vagrantfile配置文件。

4、初始化完成之后就可以启动了,执行命令:vagrant up

5、添加centos会出现ssh认证问题,添加ubuntu没有这个问题,到现在都不知道怎么解决???


遇到的问题:

$ vagrant up
...
==> centos: Waiting for machine to boot. This may take a few minutes...
    centos: SSH address: 10.211.55.235:22
    centos: SSH username: vagrant
    centos: SSH auth method: private key
    centos: Warning: Connection refused. Retrying...
    centos:
    centos: Vagrant insecure key detected. Vagrant will automatically replace
    centos: this with a newly generated keypair for better security.
    centos:
    centos: Inserting generated public key within guest...
    centos: Removing insecure key from the guest if it's present...
    centos: Key inserted! Disconnecting and reconnecting using new SSH key...
    centos: Warning: Authentication failure. Retrying...
    centos: Warning: Authentication failure. Retrying...
    centos: Warning: Authentication failure. Retrying...
    centos: Warning: Authentication failure. Retrying...
    centos: Warning: Authentication failure. Retrying...
...

解决:

其实我也不知道怎么解决,感觉就自然就好了,是不是网络原因我也不知道,不过在好之前我设置了一下虚拟机的~/.ssh/authorized_keys文件权限为600,之前是644.

参考:

  1. https://github.com/mitchellh/...

  2. http://www.cnblogs.com/woshim...

参考:

  1. vagrant系列一:vagrant的安装与初识

  2. 使用Homestead搭建开发环境


Awbeci
3.1k 声望212 粉丝

Awbeci


引用和评论

0 条评论