LoginSignup
14
14

More than 5 years have passed since last update.

VagrantでDigitalOceanのCent OS 6.5を使う

Last updated at Posted at 2014-02-17

前から気になっていた DigitalOcean を試しに使ってみたら、Cent OS 6.5のイメージが起動しなくてハマったのでメモ。

インスタンス作成

まずは『MacからVagrantコマンド一発でSSDなVPS(DigitalOcean)上にCentOS6.5+Docker環境を構築する』を参考に適当なVagrantfileを作成。

image には Cent OS 6.5 x64 を、リージョンは Singapore 1 をそれぞれ指定した。

$ vagrant up
Bringing machine 'default' up with 'digital_ocean' provider...
[default] Using existing SSH key: foobar
[default] Creating a new droplet...
[default] Assigned IP address: XXX.XXX.XXX.XXX
[default] Modifying sudoers file to remove tty requirement...
[default] Rsyncing folder: /tmp/hoge/ => /vagrant...
There was an error when attemping to rsync a share folder.
Please inspect the error message below for more info.

Host path: /tmp/hoge/
Guest path: /vagrant
Error: bash: rsync: コマンドが見つかりません
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: remote command not found (code 127) at io.c(226) [sender=3.1.0]

失敗…。
どうやらゲストのイメージに rsync(1) が入っていないようだ。プロビジョニングも行われない。

対策

状態を確認する。

$ vagrant status
Current machine states:

default                   active (digital_ocean)

active

インスタンスの起動はできているようなので、sshでリモートに入り、rsyncをインストールした。

$ vagrant ssh
[root@hoge ~]# yum -y install rsync
[root@hoge ~]# rsync --version
rsync  version 3.0.6  protocol version 30
(...)

パスが通っていることを確認して、インスタンスをリロードする。

$ vagrant reload
[default] Rebooting the droplet...
[default] Rsyncing folder: /tmp/hoge/ => /vagrant...
[default] Running provisioner: shell...
[default] Running: inline script
(...)

無事に /vagrant 以下が同期され、プロビジョニングも行われた。

まとめ

  • Cent OS 6.5のイメージにrsyncが含まれていないため、Vagrant経由でインスタンス生成すると失敗する。(2014/2/16現在)
  • インスタンスにrsyncをインストールし、再起動させれば解決した。
14
14
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
14