curl https://raw.github.com/hokaccha/nodebrew/master/nodebrew | perl - setup
# ユーザーディレクトリにインストールされるので、全ユーザーで利用する場合はrootでインストールして共通パス通すのがいいかも
# ノードユーザー作って権限渡したほうが良い気がする
useradd node
cd /home/node
chmod -R 777 /home/node
echo 'export PATH="/home/node/.nodebrew/current/bin:$PATH"' >> /etc/profile.d/nodebrew.sh
# echo 'export PATH="/home/node/.nodebrew/current/bin:$PATH"' >> /etc/profile.d/nodebrew.sh
source /etc/profile.d/nodebrew.sh
echo $PATH
# ユーザー権限でも実行したい場合は実行グループ作って登録すれば大丈夫。
nodeグループを作成
groupadd node
usermod -G wheel,node shuhei
# usermod -G wheel,node,ruby shuhei
groups shuhei
.nodebrewの所有グループを変更
cd /home/node
chgrp -R node .nodebrew
chmod -R g+rwxX .nodebrew
/home/nodeへの閲覧権限がなかったのでグループをwheelに変更
sudo chgrp wheel /root
インストール可能なバージョンの確認
nodebrew ls-all
# 奇数バージョンは開発版、偶数バージョンが安定版らしい
インストール(バイナリからインストールしたほうが速い)
nodebrew install-binary v0.10.20
# インストールはユーザーディレクトリにされるっぽいのでノードユーザーでインストールする
利用するバージョンを変更
nodebrew use v0.10.20
現在のバージョンを確認
node -v