devroom.io/content/posts/2011-10-24-installing-node-js-and-npm-on-ubuntu-debian.md

62 lines
1.1 KiB
Markdown
Raw Normal View History

2015-03-26 11:28:08 +00:00
+++
date = "2011-10-24"
title = "Installing Node.js and NPM on Ubuntu/Debian"
tags = ["Linux", "Ubuntu", "debian", "nodejs", "devops", "node", "npm"]
slug = "installing-node-js-and-npm-on-ubuntu-debian"
+++
2016-05-30 07:34:44 +00:00
This is just short snippet on how to install Node.js (any version) and NPM (Node Package Manager) on your Ubuntu/Debian system.
2016-05-30 07:35:56 +00:00
## Step 1 - Update your system
2016-05-30 07:34:44 +00:00
2017-03-20 15:35:19 +00:00
``` shell
sudo apt-get update
sudo apt-get install git-core curl build-essential openssl libssl-dev
```
2016-05-30 07:34:44 +00:00
2016-05-30 07:35:56 +00:00
## Step 2 - Install Node.js
2016-05-30 07:34:44 +00:00
First, clone the Node.js repository:
2017-03-20 15:35:19 +00:00
``` shell
git clone https://github.com/joyent/node.git
cd node
```
2016-05-30 07:34:44 +00:00
Now, if you require a specific version of Node:
2017-03-20 15:35:19 +00:00
``` shell
git tag # Gives you a list of released versions
git checkout v0.4.12
```
2016-05-30 07:34:44 +00:00
Then compile and install Node like this:
2017-03-20 15:35:19 +00:00
``` shell
./configure
make
sudo make install
```
2016-05-30 07:34:44 +00:00
Then, check if node was installed correctly:
2017-03-20 15:35:19 +00:00
``` shell
node -v
```
2016-05-30 07:34:44 +00:00
2016-05-30 07:35:56 +00:00
## Step 3 - Install NPM
2016-05-30 07:34:44 +00:00
Simply run the NPM install script:
2017-03-20 15:35:19 +00:00
``` shell
curl -L https://npmjs.org/install.sh | sudo sh
```
2016-05-30 07:34:44 +00:00
And then check it works:
2017-03-20 15:35:19 +00:00
``` shell
npm -v
```
2015-03-26 11:28:08 +00:00
2016-05-30 07:34:44 +00:00
That's all.
2015-03-26 11:28:08 +00:00