How to install Node.js on Linux

How to install Node.js on Linux

Posted on November 13, 2015 by Dan Nanni Leave a comment

Question: How can I install Node.js on [insert your Linux distro]?

Node.js is a server-side software platform built on Google‘s V8 JavaScript engine. Node.js has become a popular choice for building high-performance server-side applications all in JavaScript. What makes Node.js even more attractive for backend server development is the huge ecosystem of Node.js libraries and applications. Node.js comes with a command line utility called npm which allows you to easily install, version-control, and manage dependencies of Node.js libraries and applications from the vast npm online repository.

In this tutorial, I will describe how to install Node.js on major Linux distros including Debian, Ubuntu, Fedora and CentOS.

Node.js is available as a pre-built package on some distros (e.g., Fedora or Ubuntu), while you need to install it from its source on other distros. As Node.js is fast evolving, it is recommended to install the latest Node.js from its source, instead of installing an outdated pre-built package. The lasted Node.js comes with npm (Node.js package manager) bundled, allowing you to install external Node.js modules easily.

Install Node.js on Debian

Starting from Debian 8 (Jessie), Node.js is available in the official repositories. Thus you can install it with:

$ sudo apt-get install npm

On Debian 7 (Wheezy) or earlier, you can install Node.js from its source as follows.

$ sudo apt-get install python g++ make
$ wget http://nodejs.org/dist/node-latest.tar.gz
$ tar xvfvz node-latest.tar.gz
$ cd node-v0.10.21 (replace a version with your own)
$ ./configure
$ make
$ sudo make install

Install Node.js on Ubuntu or Linux Mint

Node.js is included in Ubuntu (13.04 and higher). Thus installation is straightforward. The following will install Node.js and npm.

$ sudo apt-get install npm
$ sudo ln -s /usr/bin/nodejs /usr/bin/node

While stock Ubuntu ships Node.js, you can install a more recent version from its PPA.

$ sudo apt-get install python-software-properties python g++ make
$ sudo add-apt-repository -y ppa:chris-lea/node.js
$ sudo apt-get update
$ sudo apt-get install npm

Install Node.js on Fedora

Node.js is included in the base repository of Fedora. Therefore you can use yum to install Node.js on Fedora.

$ sudo yum install npm

If you want to install the latest version of Node.js, you can build it from its source as follows.

$ sudo yum groupinstall ‘Development Tools‘
$ wget http://nodejs.org/dist/node-latest.tar.gz
$ tar xvfvz node-latest.tar.gz
$ cd node-v0.10.21 (replace a version with your own)
$ ./configure
$ make
$ sudo make install

Install Node.js on CentOS or RHEL

To install Node.js with yum package manager on CentOS, first enable EPEL repository, and then run:

$ sudo yum install npm

If you want to build the latest Node.js on CentOS, follow the same procedure as in Fedora.

Install Node.js on Arch Linux

Node.js is available in the Arch Linux community repository. Thus installation is as simple as running:

$ sudo pacman -S nodejs npm

Check the Version of Node.js

Once you have installed Node.js, you can check Node.js version as follows

On ec2 instance, you may need to do :

sudo ln -s /usr/local/bin/node /usr/bin/node
sudo ln -s /usr/local/lib/node /usr/lib/node
sudo ln -s /usr/local/bin/npm /usr/bin/npm
sudo ln -s /usr/local/bin/node-waf /usr/bin/node-waf
时间: 2024-11-25 11:59:41

How to install Node.js on Linux的相关文章

Install Node.js

http://www.androidren.com/index.php?qa=264&qa_1=install-node-js The best way to install Node.js is installing with nvm. cURL: $ curl https://raw.github.com/creationix/nvm/master/install.sh | sh Wget: $ wget -qO- https://raw.github.com/creationix/nvm/

[译]How to Install Node.js on Ubuntu 14.04 如何在ubuntu14.04上安装node.js

**原文链接为** [http://www.hostingadvice.com/how-to/install-nodejs-ubuntu-14-04/](http://www.hostingadvice.com/how-to/install-nodejs-ubuntu-14-04/) **由作者Jacob Nicholson 发表于October 27, 2015** **在此对作者表示感谢** Node.js作为一个基于JavaScript的开发平台,正变得越来越流行.许多开发人员都想构建通过

How to Install Node.js

Ubuntu Install the dependencies: sudo apt-get install g++ curl libssl-dev apache2-utils sudo apt-get install git-core Run the following commands: git clone git://github.com/ry/node.gitcd node./configuremakesudo make install You can check it worked wi

node.js在linux下的安装

简单说就是解压后,在bin文件夹中已经存在node以及npm,如果你进入到对应文件的中执行命令行一点问题都没有,不过不是全局的,所以将这个设置为全局就好了. ? 1 2 3 cd node-v0.10.28-linux-x64/bin ls ./node -v 这就妥妥的了,node文件夹具体放在哪,叫什么名字随你怎么定.然后设置全局: ? 1 2 ln -s /home/kun/mysofltware/node-v0.10.28-linux-x64/bin/node /usr/local/bi

Node.js 切近实战(十二) 之Linux部署

之前的话我们的项目都是跑在windows上,今天我们要将我们的程序跑到linxu机器上.在看linux部署之前,我们先看一下node.js类似于asp.net mvc的过滤器或者叫拦截器.在app.js中我们加入如下代码 var beforeRequest = function (req, res, next) {     if (req.originalUrl == '/'          || req.originalUrl == '/login'          || req.orig

A chatroom for all! Part 1 - Introduction to Node.js(转发)

项目组用到了 Node.js,发现下面这篇文章不错.转发一下.原文地址:<原文>. ------------------------------------------- A chatroom for all! Part 1 - Introduction to Node.js Rami Sayar 4 Sep 2014 11:00 AM 7 This node.js tutorial series will help you build a node.js powered real-time

Node.js安装 下载

1.安装Node.js https://nodejs.org/en/ 安装步骤: 点击安装包 按提示进行安装 Node.js 安装配置 本章节我们将向大家介绍在 Windows 和 Linux 上安装 Node.js 的方法. 本安装教程以 Node.js v4.4.3 LTS(长期支持版本)版本为例. Node.js 安装包及源码下载地址为:https://nodejs.org/en/download/. 你可以根据不同平台系统选择你需要的 Node.js 安装包. Node.js 历史版本下

Docker 生成Node.js web app(含端口映射)

1.新建目录src,并进入src目录 [[email protected] Documents]$ mkdir src [[email protected] Documents]$ cd src/ 2.创建package.json和index.js文件,文件内容如下: package.json [[email protected] Documents]$ mkdir src [[email protected] Documents]$ cd src/ [[email protected] src

WebSockets in Node.js for Windows 7

NOTE:  This is an update of my previous post on configuring WebSockets on a Windows 7 installation of Node.js. One of the lesser known features of HTML5 are WebSockets.  This is mainly due to a lack of browser support and standardization.  Still, the