2018/3/19

install node.js in debian 9 - stretch

ref:How to install nodejs on debian 9 (stretch)

他說 stretch 的 nodejs package 用的 nodejs 版本太舊,不建議使用。
建議自己安裝。

文章的方法是 run deb.nordesource.com 的 script,他會邦你加入 nodejs 的 source repository,
之後就可以用 apt 安裝。

## Confirming "stretch" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_6.x/dists/stretch/Release'

## Adding the NodeSource signing key to your keyring...

+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
OK

## Creating apt sources list file for the NodeSource Node.js v6.x LTS Boron repo...

+ echo 'deb https://deb.nodesource.com/node_6.x stretch main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src https://deb.nodesource.com/node_6.x stretch main' >> /etc/apt/sources.list.d/nodesource.list

...
...

## Run `apt-get install nodejs` (as root) to install Node.js v6.x LTS Boron and npm

然後 run apt-get install nodejs 就會安裝這個版本的 node.


附上其他distribution 的方法(其實一樣):nodejs package manager
在 trusty 上 run setup_6.x 的 log 中..
## Confirming "trusty" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_6.x/dists/trusty/Release'

## Adding the NodeSource signing key to your keyring...

+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
OK

## Creating apt sources list file for the NodeSource Node.js v6.x LTS Boron repo...

+ echo 'deb https://deb.nodesource.com/node_6.x trusty main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src https://deb.nodesource.com/node_6.x trusty main' >> /etc/apt/sources.list.d/nodesource.list

## Running `apt-get update` for you...
就是上面手動做的..

沒有留言:

張貼留言