秘密鍵のパーミッションを変更
所有者のみ読み込み可能(下記コマンドを実行後、SSHでEC2にログインできるようになった。)
chmod 400 hoge-key.pem
ローカルからEC2へのログインは.sshディレクトリに移動してから行う
vagrant@vagrant-ubuntu-trusty:~$ cd .ssh
vagrant@vagrant-ubuntu-trusty:~/.ssh$ ssh -i hoge_key.pem ec2-user@12.345.67.890
vagrantユーザは、ec2-userと同じく、sudoを実行できる
vagrant@vagrant-ubuntu-trusty:/var$ mkdir -p www/test_app
mkdir: cannot create directory ‘www’: Permission denied
vagrant@vagrant-ubuntu-trusty:/var$ sudo mkdir -p www/test_app
vagrant@vagrant-ubuntu-trusty:/var/www/test_app$ git clone git@github.com:hogehoge/fugafuga_service.git
fatal: could not create work tree dir 'fugafuga_service'.: Permission denied
vagrant@vagrant-ubuntu-trusty:/var/www/test_app$ sudo git clone git@github.com:hogehoge/fugafuga_service.git
ローカルでのアプリの作成
「cd /var/www」では、「rails new -d hoge_app -d postgresql」、は実行できない。「rails -v」コマンドを実行してもRailsのバージョンは表示されない。
vagrant@vagrant-ubuntu-trusty:~$ pwd ※ここで、「rails -v」を実行すると、Railsのバージョンは表示される。
/home/vagrant
vagrant@vagrant-ubuntu-trusty:~$ rails new -d hoge_app -d postgresql ← で、行う!!
vagrant@vagrant-ubuntu-trusty:~$ ls
archive hoge_app
vagrant(Ubuntu)にログインしたらまず行うこと
sudo apt-get update
sudo apt-get upgrade
参考サイト
http://qiita.com/kazoo04/items/289c4f6a8501df3a7359
http://webkaru.net/linux/apt-get-command/