vagrant up
で box のダウンロードから始まるのが羨ましくてバージョンアップしました。
環境
OS X Yosemite 10.10.4
$ vagrant --version
Vagrant 1.3.5
ずいぶん古いです。
バージョンアップ前
$ vagrant init centos/7
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:
vm:
* The box 'centos/7' could not be found.
VirtualBox バージョンアップ
公式 から最新版(執筆時点では 5.0.8)のパッケージをダウンロードし、インストールするだけです。
Vagrant のバージョンアップ
最新版のインストール
公式 からパッケージをダウンロードして、普通にインストールします。
確認
バージョンを確認してみると、エラーになりました。パスが変わった模様。
$ vagrant --version
-bash: /usr/bin/vagrant: No such file or directory
パッケージ同梱の uninstall.tool
を見てみると以下の記載がありました。
my_files=()
append my_files "/opt/vagrant"
append my_files "/usr/local/bin/vagrant"
なので、とりあえず実行してみます。
$ sudo /usr/local/bin/vagrant
Password:
Vagrant is upgrading some internal state for the latest version.
Please do not quit Vagrant at this time. While upgrading, Vagrant
will need to copy all your boxes, so it will use a considerable
amount of disk space. After it is done upgrading, the temporary disk
space will be freed.
Press ctrl-c now to exit if you want to remove some boxes or free
up some disk space.
Press the Enter or Return key to continue.
upgrade が始まるようです。
Enter キーを押すとオプションの一覧が表示されました。
Usage: vagrant [options] <command> [<args>]
-v, --version Print the version and exit.
-h, --help Print this help.
Common commands:
box manages boxes: installation, removal, etc.
connect connect to a remotely shared Vagrant environment
destroy stops and deletes all traces of the vagrant machine
global-status outputs status Vagrant environments for this user
halt stops the vagrant machine
help shows the help for a subcommand
init initializes a new Vagrant environment by creating a Vagrantfile
login log in to HashiCorp's Atlas
package packages a running vagrant environment into a box
plugin manages plugins: install, uninstall, update, etc.
provision provisions the vagrant machine
push deploys code in this environment to a configured destination
rdp connects to machine via RDP
reload restarts vagrant machine, loads new Vagrantfile configuration
resume resume a suspended vagrant machine
share share your Vagrant environment with anyone in the world
ssh connects to machine via SSH
ssh-config outputs OpenSSH valid configuration to connect to the machine
status outputs status of the vagrant machine
suspend suspends the machine
up starts and provisions the vagrant environment
vbguest
version prints current and latest Vagrant version
For help on any individual command run `vagrant COMMAND -h`
Additional subcommands are available, but are either more advanced
or not commonly used. To see all subcommands, run the command
`vagrant list-commands`.
それでも $ vagrant
だけでは no such file or directrory
なので一度 bash をログアウトしてから再実行してみます。
$ vagrant
Usage: vagrant [options] <command> [<args>]
-v, --version Print the version and exit.
-h, --help Print this help.
Common commands:
box manages boxes: installation, removal, etc.
connect connect to a remotely shared Vagrant environment
destroy stops and deletes all traces of the vagrant machine
global-status outputs status Vagrant environments for this user
halt stops the vagrant machine
help shows the help for a subcommand
init initializes a new Vagrant environment by creating a Vagrantfile
login log in to HashiCorp's Atlas
package packages a running vagrant environment into a box
plugin manages plugins: install, uninstall, update, etc.
provision provisions the vagrant machine
push deploys code in this environment to a configured destination
rdp connects to machine via RDP
reload restarts vagrant machine, loads new Vagrantfile configuration
resume resume a suspended vagrant machine
share share your Vagrant environment with anyone in the world
ssh connects to machine via SSH
ssh-config outputs OpenSSH valid configuration to connect to the machine
status outputs status of the vagrant machine
suspend suspends the machine
up starts and provisions the vagrant environment
vbguest
version prints current and latest Vagrant version
For help on any individual command run `vagrant COMMAND -h`
Additional subcommands are available, but are either more advanced
or not commonly used. To see all subcommands, run the command
`vagrant list-commands`.
/opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/machine_index.rb:321:in `initialize': Permission denied - /Users/hoge/.vagrant.d/data/machine-index/index.lock (Errno::EACCES)
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/machine_index.rb:321:in `open'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/machine_index.rb:321:in `with_index_lock'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/machine_index.rb:52:in `initialize'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/environment.rb:620:in `new'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/environment.rb:620:in `machine_index'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/environment.rb:208:in `block in action_runner'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/runner.rb:33:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/runner.rb:33:in `run'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/environment.rb:428:in `hook'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/environment.rb:671:in `unload'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/bin/vagrant:177:in `<main>'
パスは通りましたが、 permission エラーになりましたので、権限を変えてみます。
$ sudo chown -R user:usergroup /Users/hoge/.vagrant.d/
再度 vagrant コマンドを実行します。
$ vagrant
Usage: vagrant [options] <command> [<args>]
-v, --version Print the version and exit.
-h, --help Print this help.
Common commands:
box manages boxes: installation, removal, etc.
connect connect to a remotely shared Vagrant environment
destroy stops and deletes all traces of the vagrant machine
global-status outputs status Vagrant environments for this user
halt stops the vagrant machine
help shows the help for a subcommand
init initializes a new Vagrant environment by creating a Vagrantfile
login log in to HashiCorp's Atlas
package packages a running vagrant environment into a box
plugin manages plugins: install, uninstall, update, etc.
provision provisions the vagrant machine
push deploys code in this environment to a configured destination
rdp connects to machine via RDP
reload restarts vagrant machine, loads new Vagrantfile configuration
resume resume a suspended vagrant machine
share share your Vagrant environment with anyone in the world
ssh connects to machine via SSH
ssh-config outputs OpenSSH valid configuration to connect to the machine
status outputs status of the vagrant machine
suspend suspends the machine
up starts and provisions the vagrant environment
vbguest
version prints current and latest Vagrant version
For help on any individual command run `vagrant COMMAND -h`
Additional subcommands are available, but are either more advanced
or not commonly used. To see all subcommands, run the command
`vagrant list-commands`.
OK のようです。バージョンは 1.7.4
まで上がりました。
$ vagrant --version
Vagrant 1.7.4
その後、新規の仮想マシンを vagrant init
と vagrant up
で動かすことができました。