Linux 在 Debian 6.0 上安装 node.js
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10478768/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Installing node.js on Debian 6.0
提问by Wingblade
So well, I have a vserver with Debian 6.0.
好吧,我有一个带有 Debian 6.0 的虚拟服务器。
Now I would like to install Node.js, but none of the tutorials on the web seem to work. I have tried all of the results google gives me when I enter "install node.js on linux" I mostly failed because I had no idea how to install the dependencies (I'm new to linux btw)
现在我想安装 Node.js,但网络上的教程似乎都不起作用。我已经尝试了当我输入“在 linux 上安装 node.js”时谷歌给我的所有结果我大多失败了,因为我不知道如何安装依赖项(顺便说一句,我是 linux 新手)
How to install node.js on a Debian system that was just setup (so no programs already installed on it and such)?
如何在刚刚设置的 Debian 系统上安装 node.js(因此没有安装程序等)?
采纳答案by Julian Knight
Although, as ArjunShankar says, you should normally use a pre-built package. Node.js is rather too fast moving for Debian packages to keep up. I would strongly recommend that you do your own installs until such a time as Node settles down. For example, there was an unexpected update recently that fixes an important security loophole - you do not want to be dependent on a package that is for an out-of-date version of Debian when things need to move fast.
虽然,正如 ArjunShankar 所说,您通常应该使用预先构建的包。Node.js 的发展速度太快了,Debian 软件包无法跟上。我强烈建议您自行安装,直到 Node 稳定下来。例如,最近有一个意外更新修复了一个重要的安全漏洞 - 当事情需要快速发展时,您不希望依赖用于过时 Debian 版本的软件包。
Instead, you should install from source.
相反,您应该从源代码安装。
You can download the source archive direct unpack it into a temporary folder and follow the instructions on the Node Github page. Alternatively, if you are confident with GIT, you can use that to grab the source - again to a temporary folder & follow the installation instructions.
您可以下载源存档,直接将其解压到一个临时文件夹中,然后按照Node Github 页面上的说明进行操作。或者,如果您对 GIT 有信心,您可以使用它来获取源 - 再次到一个临时文件夹并按照安装说明进行操作。
There are a number of software dependencies for compiling so you need to make sure that you have them first - they should all be in the Debian apt packages. See http://blog.timmattison.com/archives/2011/04/26/installing-nodejs-couchdb-and-npm-on-debian-the-easy-way/or http://sekati.com/etc/install-nodejs-on-debian-squeezefor further information.
有许多用于编译的软件依赖项,因此您需要确保首先拥有它们——它们都应该在 Debian apt 软件包中。请参阅http://blog.timmattison.com/archives/2011/04/26/installing-nodejs-couchdb-and-npm-on-debian-the-easy-way/或http://sekati.com/etc/ install-nodejs-on-debian-squeeze了解更多信息。
It will take a few minutes to do the compile so be patient.
编译需要几分钟时间,请耐心等待。
Once you've done it once, upgrades are also easy - just repeat the download/compile process.
完成一次后,升级也很容易 - 只需重复下载/编译过程。
Node.js installations now include the npm tool so installing libraries and other code is extremely simple.
Node.js 安装现在包括 npm 工具,因此安装库和其他代码非常简单。
回答by Richard Nienaber
If anyone else needs step-by-step instructions, I used the following steps from Install Node.js on Debian Squeezeand it installed with no problems:
如果其他人需要分步说明,我使用了在 Debian Squeeze 上安装 Node.js 中的以下步骤,并且安装没有问题:
sudo apt-get update && sudo apt-get install git-core curl build-essential openssl libssl-dev
git clone https://github.com/nodejs/node.git
cd node
git checkout v5.0.0
(or the version you want to build)./configure
make
sudo make install
node -v
npm -v
sudo apt-get update && sudo apt-get install git-core curl build-essential openssl libssl-dev
git clone https://github.com/nodejs/node.git
cd node
git checkout v5.0.0
(或您要构建的版本)./configure
make
sudo make install
node -v
npm -v
I didn't have to install any additional sources into apt to get it to build.
我不必在 apt 中安装任何额外的源来构建它。
回答by jishi
Just wanted to add this:
只是想添加这个:
http://ypcs.fi/howto/2012/10/09/nodejs-debian/
http://ypcs.fi/howto/2012/10/09/nodejs-debian/
I successfully used this for wheezy, however I only got v0.6.19 and it is atm on 0.8.2.
我成功地将它用于 wheezy,但是我只得到了 v0.6.19 并且它是 0.8.2 上的 atm。
回答by mdw
As others have mentioned, node.js has quite a rapid release cycle, and the official Debian packages lag somewhat. I have a need to keep a group of Debian servers up-to-date with node.js, so I've been using this:
正如其他人提到的,node.js 的发布周期相当快,官方的 Debian 软件包有些滞后。我需要使用 node.js 使一组 Debian 服务器保持最新,所以我一直在使用它:
https://github.com/mark-webster/node-debian
https://github.com/mark-webster/node-debian
Which allows you to build .deb files for arbitrary versions of node.js, so you can install / upgrade / uninstall it easily. It's a bit quick and dirty, but at least it's something until the official Debian packages arrive.
它允许您为任意版本的 node.js 构建 .deb 文件,因此您可以轻松安装/升级/卸载它。它有点快速和肮脏,但至少在官方 Debian 软件包到来之前是这样。
For an insight into the complications facing Debian package maintainers regarding node.js, see this thread:
要深入了解 Debian 软件包维护者在 node.js 方面面临的复杂性,请参阅此线程:
https://groups.google.com/d/msg/nodejs/W_6avRSG_a8/xeQxLGuHQ5YJ
https://groups.google.com/d/msg/nodejs/W_6avRSG_a8/xeQxLGuHQ5YJ
回答by mdw
I added my own node.js / debian package builder here:
我在这里添加了我自己的 node.js/debian 包构建器:
https://github.com/aw/nodejs-debian
https://github.com/aw/nodejs-debian
It uses the official node.js git repo to pull down the exact version you want to build, and creates an easy to distribute .deb package.
它使用官方的 node.js git repo 来拉取你想要构建的确切版本,并创建一个易于分发的 .deb 包。