LoginSignup
1
1

More than 5 years have passed since last update.

AWS Nodejs

Last updated at Posted at 2016-01-15

インスタンスにnode.jsをセットアップ

sshで対象のインスタンスにログインし、下記コマンドを順番に実行していきます。

yumのアップデート

$ sudo yum update

必要なパッケージをyumからインストール

$ sudo yum install git gcc-c++ make openssl-devel

nvmをgitリポジトリからclone

$ git clone git://github.com/creationix/nvm.git .nvm

~/.bash_profileに以下の設定を追加
viは入力モードとコマンドモードを切り替えて操作します。

$ vi ~/.bash_profile

初期状態はコマンドモードでテキスト入力はできませんが、iを押す事で入力モードに切り替わり入力可能になります。矢印キーなどでファイルの末尾に移動してからiを押して、以下を追記してください。

if [[ -s ~/.nvm/nvm.sh ]];
 then source ~/.nvm/nvm.sh
fi

インストール可能なnode.jsのバージョンの一覧を確認
(今回はnode.js v4.2.2のインストールを例にします。)

$ nvm ls-remote

nvmからnode.jsをインストール

$ nvm install v4.2.2

念のためバージョンが正しいか確認

$ node -v

nvmのデフォルトバージョンを定義

$ nvm alias default v4.2.2
1
1
0

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
1
1