WindowsにVagrantをインストールする方法はこちらをご参照ください。
Windows8にVagrant入れてみた
経緯
Ubuntu13.04のboxではなぜかGitをインストールできませんでした。レポジトリの参照先がnot foundとなってしまったのです。
利用していたbox
Official Ubuntu 13.04 daily Cloud Image amd64 (No Guest Additions)
Vagrantbox.esから取得したものです。
実際にコンソールからOSのバージョン見るとこんな感じ。
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=13.04
DISTRIB_CODENAME=raring
DISTRIB_DESCRIPTION="Ubuntu 13.04"
$ arch
x86_64
Gitインストール時のログは以下。
$ sudo apt-get install git
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
git-man liberror-perl
Suggested packages:
git-daemon-run git-daemon-sysvinit git-doc git-el git-arch git-cvs git-svn git-email git-gui gitk gitweb
The following NEW packages will be installed:
git git-man liberror-perl
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 7,516 kB/7,540 kB of archives.
After this operation, 17.2 MB of additional disk space will be used.
(中略)
Ign http://archive.ubuntu.com raring-updates/universe Translation-en_US
Ign http://archive.ubuntu.com raring-updates/universe Translation-en
Err http://archive.ubuntu.com raring/main amd64 Packages
404 Not Found [IP: 91.189.91.15 80]
Err http://archive.ubuntu.com raring/universe amd64 Packages
404 Not Found [IP: 91.189.91.15 80]
Err http://archive.ubuntu.com raring-updates/main amd64 Packages
404 Not Found [IP: 91.189.91.15 80]
Err http://archive.ubuntu.com raring-updates/universe amd64 Packages
404 Not Found [IP: 91.189.91.15 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/main/source/Sources 404 Not Found [IP: 91.189.91.14 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/universe/source/Sources 404 Not Found [IP:91.189.91.14 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/raring/main/source/Sources 404 Not Found [IP: 91.189.91.15 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/raring/universe/source/Sources 404 Not Found [IP: 91.189.91.15 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/main/binary-amd64/Packages 404 Not Found [IP: 91.189.91.14 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/raring-updates/main/source/Sources 404 Not Found [IP: 91.189.91.15 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/raring-updates/universe/source/Sources 404 Not Found [IP: 91.189.91.15 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/universe/binary-amd64/Packages 404 Not Found [IP: 91.189.91.14 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/raring/main/binary-amd64/Packages 404 Not Found [IP: 91.189.91.15 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/raring/universe/binary-amd64/Packages 404 Not Found [IP: 91.189.91.15 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/raring-updates/main/binary-amd64/Packages 404 Not Found [IP: 91.189.91.15 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/raring-updates/universe/binary-amd64/Packages 404 Not Found[IP: 91.189.91.15 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
404が出ている。レポジトリURLが変わったのでしょうね。Ubuntuのレポジトリ参照先を変更してもいいのですが面倒です。 という訳でOSごと入れ直します。
boxを追加する
いつも通りVagrantbox.esで品定め。Ubuntu14のboxは2つしかなく下記のboxを選択
Official Ubuntu 14.04 daily Cloud Image amd64 (Development release, No Guest Additions)
早速addします。
$ vagrant box add ubuntu14 https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box
OSのimageの取得に小一時間くらいかかります。私の場合はなぜか30%のところでDLが止まってしまったのでやり直しました。
今追加したboxを利用してVagrant init
Vagrantfileを置きたいディレクトリに移動してinit
します。
$ vagrant init ubuntu14
SSHでログインしてGitをインストールしてみる
$ vagrant ssh
# VMにログインしたら
sudo apt-get install git
うん、無事にインストールされました。 だいぶVagrantに慣れてきた感じがします。どんどん使っていこう。
ちなみに私はvagrant ssh
する時はPowerShell使っています(どうでもいい)。