Merge pull request #3535 from strugglingyouth/master

翻译完成
This commit is contained in:
struggling 2015-11-20 00:14:58 +08:00
commit 85413a4b69
2 changed files with 92 additions and 92 deletions

View File

@ -1,92 +0,0 @@
translation by strugglingyouth
Linux FAQs with Answers--How to install Node.js on Linux
================================================================================
> **Question**: How can I install Node.js on [insert your Linux distro]?
[Node.js][1] 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][2] 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][3].
$ 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.
$ node --version
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/install-node-js-linux.html
作者:[Dan Nanni][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://ask.xmodulo.com/author/nanni
[1]:http://nodejs.org/
[2]:https://www.npmjs.com/
[3]:https://launchpad.net/~chris-lea/+archive/node.js

View File

@ -0,0 +1,92 @@
Linux 有问必答 - 如何在 Linux 上安装 Node.js
================================================================================
> **问题**: 如何在你的 Linux 发行版上安装 Node.js
[Node.js][1] 是建立在谷歌的 V8 JavaScript 引擎服务器端的软件平台上。在构建高性能的服务器端应用程序上Node.js 在 JavaScript 中已是首选方案。是什么让使用 Node.js 库和应用程序的 [庞大生态系统][2] 来开发服务器后台变得如此流行。Node.js 自带一个被称为 npm 的命令行工具可以让你轻松地安装它,进行版本控制并使用 npm 的在线仓库来管理 Node.js 库和应用程序的依赖关系。
在本教程中,我将介绍 **如何在主流 Linux 发行版上安装 Node.js包括DebianUbuntuFedora 和 CentOS**
Node.js 在一些发行版上作为预构建的程序包Fedora 或 Ubuntu而在其他发行版上你需要源码安装。由于 Node.js 发展比较快,建议从源码安装最新版而不是安装一个过时的预构建的程序包。最新的 Node.js 自带 npmNode.js 的包管理器),让你可以轻松的安装 Node.js 的外部模块。
### 在 Debian 上安装 Node.js on ###
从 Debian 8 (Jessie)开始Node.js 已被纳入官方软​​件仓库。因此,你可以使用如下方式安装它:
$ sudo apt-get install npm
在 Debian 7 (Wheezy) 以前的版本中,你需要使用下面的方式来源码安装:
$ 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
### 在 Ubuntu 或 Linux Mint 中安装 Node.js ###
Node.js 被包含在 Ubuntu13.04 及更高版本)。因此,安装非常简单。以下方式将安装 Node.js 和 npm。
$ sudo apt-get install npm
$ sudo ln -s /usr/bin/nodejs /usr/bin/node
而 Ubuntu 中的 Node.js 可能版本比较老,你可以从 [其 PPA][3] 中安装最新的版本。
$ 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
### 在 Fedora 中安装 Node.js ###
Node.js 被包含在 Fedora 的 base 仓库中。因此,你可以在 Fedora 中用 yum 安装 Node.js。
$ sudo yum install npm
如果你想安装 Node.js 的最新版本,可以按照以下步骤使用源码来安装。
$ 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
### 在 CentOS 或 RHEL 中安装 Node.js ###
在 CentOS 使用 yum 包管理器来安装 Node.js首先启用 EPEL 软件库,然后运行:
$ sudo yum install npm
如果你想在 CentOS 中安装最新版的 Node.js其安装步骤和在 Fedora 中的相同。
### 在 Arch Linux 上安装 Node.js ###
Node.js is available in the Arch Linux community repository. Thus installation is as simple as running:
Node.js 在 Arch Linux 的社区库中可以找到。所以安装很简单,只要运行:
$ sudo pacman -S nodejs npm
### 检查 Node.js 的版本 ###
一旦你已经安装了 Node.js你可以使用如下所示的方法检查 Node.js 的版本。
$ node --version
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/install-node-js-linux.html
作者:[Dan Nanni][a]
译者:[strugglingyou](https://github.com/strugglingyou)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://ask.xmodulo.com/author/nanni
[1]:http://nodejs.org/
[2]:https://www.npmjs.com/
[3]:https://launchpad.net/~chris-lea/+archive/node.js