
CentOS7にnode.jsをインストールしてみたいと思います。
nodebrewを使ってインストール
Node.jsのバージョン管理ツールがあるらしく、nodebrewというみたいです。これを使ってインストールしたいと思います。
nodebrewをインストール
01 | [root@]# curl -L git.io/nodebrew | perl - setup |
03 | % Total % Received % Xferd Average Speed Time Time Time Current |
04 | Dload Upload Total Spent Left Speed |
05 | 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 |
06 | 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0 |
07 | 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0 |
08 | 100 24340 100 24340 0 0 10698 0 0:00:02 0:00:02 --:--:-- 99346 |
10 | Installed nodebrew in $HOME/.nodebrew |
12 | ======================================== |
13 | Export a path to nodebrew: |
15 | export PATH=$HOME/.nodebrew/current/bin:$PATH |
16 | ======================================== |
環境変数の設定
.bash_profileに以下を追加します。
01 | [root@]# vim ~/.bash_profile |
04 | # Get the aliases and functions |
05 | if [ -f ~/.bashrc ]; then |
09 | # User specific environment and startup programs |
14 | export PATH=$HOME/.nodebrew/current/bin:$PATH #追加 |
追加しました。
.bash_profileを読み込み直します。
07 | nodebrew help Show this message |
08 | nodebrew install <version> Download and install <version> (compile from source) |
09 | nodebrew install-binary <version> Download and install <version> (binary file) |
10 | nodebrew uninstall <version> Uninstall <version> |
11 | nodebrew use <version> Use <version> |
12 | nodebrew list List installed versions |
13 | nodebrew ls Alias for `list` |
14 | nodebrew ls-remote List remote versions |
15 | nodebrew ls-all List remote and installed versions |
16 | nodebrew alias <key> <value> Set alias |
17 | nodebrew unalias <key> Remove alias |
18 | nodebrew clean <version> | all Remove source file |
19 | nodebrew selfupdate Update nodebrew |
20 | nodebrew migrate-package <version> Install global NPM packages contained in <version> to current version |
21 | nodebrew exec <version> -- <command> Execute <command> using specified <version> |
25 | nodebrew install-binary v0.10.22 |
27 | # use a specific version number |
31 | nodebrew install-binary io@v1.0.0 |
32 | nodebrew use io@v1.0.0 |
バージョン確認します
1 | [root@]# nodebrew ls-remote |
バージョンを指定してインストール
1 | [root@]# nodebrew install-binary <version> |
安定版のインストール
1 | [root@]# nodebrew install-binary stable |
インストールしたNode.jsのバージョン確認
Node.jsのバージョンを指定
1 | [root@]# nodebrew use <version> |
Node.jsの安定版を指定
1 | [root@]# nodebrew use stable |
Node.jsとnpmのバージョン確認
Nodo.jsのインストールの成功です
個人支援・寄付について
サイトラボでは個人支援・寄付を受けております。ご協力いただける方はお願いいたします。当サイトではビットコインで受け付けております。
- ビットコイン:3LHnADwZwUbic2L45EnVJEykiG6KfbqrwS