How to install Node.js on Linux

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

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

  1. Node.js~在linux上的部署~pm2管理工具的使用

    之前写了两篇关于在linux上部署nodejs的文章,大家如果没有基础可以先看前两篇<Node.js~在linux上的部署>,<Node.js~在linux上的部署~外网不能访问no ...

  2. node.js & Unbuntu Linux & nvm & npm

    node.js & Unbuntu Linux & nvm & npm https://websiteforstudents.com/install-the-latest-no ...

  3. Node.js & Unix/Linux & NVM

    Node.js & Unix/Linux & NVM nvm https://github.com/creationix/nvm https://github.com/xyz-data ...

  4. Linux Install Node.js

    1.下载node.js安装包,请参考网址:http://nodejs.org/download/ 在这个网址里面提供了几种node.js安装的方式 https://github.com/joyent/ ...

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

    原文链接为 http://www.hostingadvice.com/how-to/install-nodejs-ubuntu-14-04/ 由作者Jacob Nicholson 发表于October ...

  6. Node.js~在linux上的部署~外网不能访问node.js网站的解决方法

    这是上一篇node.js部署到linux上的后续文章,当我们安装完node.js之后,建立了sailsjs的网站,然后在外面电脑上无法访问这个网站,这个问题我们如何去解决? 解决思路: 查看linux ...

  7. Node.js~在linux上的部署

    我们以centOS为例来说说如何部署node.js环境 一 打开centos,然后开始下载node.js包 curl --silent --location https://rpm.nodesourc ...

  8. node.js在linux下的安装

    简单说就是解压后,在bin文件夹中已经存在node以及npm,如果你进入到对应文件的中执行命令行一点问题都没有,不过不是全局的,所以将这个设置为全局就好了. ? 1 2 3 cd node-v0.10 ...

  9. node.js在Linux下执行shell命令、.sh脚本

    首先,引入子进程模块 var process = require('child_process'); 执行shell命令 调用该模块暴露出来的方法exec process.exec('shutdown ...

随机推荐

  1. DSP中常用的C语言关键字

    const Ø使用:const 数据类型 变量名: Ø作用:优化存储器的分配,表示变量的内容是常数,不会改变. Ø举例:const char tab[1024]={显示数据}; volatile(易变 ...

  2. 【ASP.Net MVC】在AspNet Mvc使用JQuery AutoComplete组件

    在AspNet Mvc使用JQuery AutoComplete组件 官方文档: http://api.jqueryui.com/autocomplete/#entry-examples 要使用JQu ...

  3. 百度之星A

    Scenic Popularity Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

  4. Cortex-M3/4的Hard Fault调试方法

    1 Cortex-M3/4的Fault简介 Cortex-M3/4的Fault异常是由于非法的存储器访问(比如访问0地址.写只读存储位置等)和非法的程序行为(比如除以0等)等造成的.常见的4种异常及产 ...

  5. 服务接口API限流 Rate Limit 续

    一.前言 上一篇文章中粗浅的介绍使用Redis和基于令牌桶算法进行对服务接口API限流,本文介绍另一种算法---漏桶算法的应用.Nginx想必大家都有所了解是一个高性能的 HTTP 和反向代理服务器, ...

  6. Codeforces 414C Mashmokh and Reverse Operation

    题意:给你2^n个数,每次操作将其分成2^k份,对于每一份内部的数进行翻转,每次操作完后输出操作后的2^n个数的逆序数. 解法:2^n个数,可以联想到建立一棵二叉树的东西,比如  2,1,4,3就可以 ...

  7. HDU 4639 Hehe(字符串处理,斐波纳契数列,找规律)

    题目 //每次for循环的时候总是会忘记最后一段,真是白痴.... //连续的he的个数 种数 //0 1 //1 1 //2 2 //3 3 //4 5 //5 8 //…… …… //斐波纳契数列 ...

  8. Spring mvc json null

    http://blog.csdn.net/zdsdiablo/article/details/9429263

  9. (3)VS2010+Opencv-2.4.8的配置攻略

    这是windows平台上的东西,我为什么要写到安卓这一块呢 因为作者做的安卓方面的东西需要先在windows平台实现一下,所以就想写这篇东西,也参考了网上很多教程,不得不感叹,这些软件版本更新的太快. ...

  10. Jmeter以non-gui模式进行分布式测试

    http://www.51testing.com/html/61/n-2422461.html