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

71 lines
1.3 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"
+++
2020-03-11 10:23:32 +00:00
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.
2020-03-11 10:23:32 +00:00
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
2020-03-11 10:23:32 +00:00
sudo apt-get install git-core curl build-essential openssl libssl-dev python
2017-03-20 15:35:19 +00:00
```
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
2020-03-11 10:23:32 +00:00
git clone https://github.com/nodejs/node.git
2017-03-20 15:35:19 +00:00
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
2020-03-11 10:23:32 +00:00
git checkout v13.10.1
2017-03-20 15:35:19 +00:00
```
2016-05-30 07:34:44 +00:00
Then compile and install Node like this:
2020-03-11 10:23:32 +00:00
<small>This might take a while, depending on your hardware.</small>
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
2020-03-11 10:23:32 +00:00
_Updated 2020-03-11_
* Use the new nodejs/node repo
* Install correct dependencies, including python\
* Update example node version to v13.10.1_