bingooyong / note

1 stars 1 forks source link

玩转 vagrant #15

Open bingooyong opened 5 years ago

bingooyong commented 5 years ago

vagrant ssh 默认使用root登录

vi Vagrantfile

config.ssh.username = 'root'
config.ssh.password = 'vagrant'
config.ssh.insert_key = 'true'
bingooyong commented 5 years ago

Vagrant改变boxes存放路径

  1. copy ~/.vagrant.d/下面的目录到新目录
    cp ~/.vagrant.d/   /path/to/vagrant_home/

    2.设置环境变量 $ grep 'VAGR' ~/.bash_profile export VAGRANT_HOME='/path/to/vagrant_home'

重新登录shell后,boxes的存放目录就在 /path/to/vagrant_home/boxes 下面了

bingooyong commented 5 years ago

导出Box文件

  1. 先启动vagrant
  2. 停止vagrant
  3. 导出文件,在当前目录下的package.box就是
vagrant up
vagrant halt
vagrant package