ISUCON7の予選問題に沿って環境を作ろうとした際に、Ubuntu 16.04の環境構築でエラーが出たのでそれについて調べた内容のまとめ
エラー内容
Vagrant に VirtualBox 用の Ubuntu 16.04 LTS の box を入れる方法を参考にコマンドを実行したところ下記のエラーが出た
タイトルにあるように、could not be foundとなっている
$ vagrant init bento/ubuntu-16.04
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'bento/ubuntu-16.04' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
The box 'bento/ubuntu-16.04' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Atlas, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:
URL: ["https://atlas.hashicorp.com/bento/ubuntu-16.04"]
Error: The requested URL returned error: 404 Not Found
原因
いくつか調べてみたところ、下記の記事にこのような記載が
The Trellis docs say that “Vagrant >= 1.8.5” is required
“The box ‘bento/ubuntu-16.04’ could not be found” error when spinning up a new Trellis project
バージョンを確認してみたら低かったので、これが問題らしい
$ vagrant -v
Vagrant 1.7.4
対応
Mac で vagrant をバージョンアップするを参考に一番新しいバージョンに変更
$ vagrant -v
Vagrant 2.0.3
$ vagrant plugin repair
これでできるようになりました
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'bento/ubuntu-16.04'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'bento/ubuntu-16.04' is up to date...
==> default: Setting the name of the VM: isucon_default_1523664078122_50761
==> default: Fixed port collision for 22 => 2222. Now on port 2201.
(追記)
isucon7の環境を作る場合にはallinone (ALL in One) 用 Playbookがあるので、こちらで作成をすると楽です