简体   繁体   English

通过 ssh 在专用服务器上安装 node.js

[英]Install node.js on dedicated server via ssh

I own a dedicated linux server from 1&1.我从 1&1 拥有一个专用的 linux 服务器。 I have SFTP and SSH access.我有 SFTP 和 SSH 访问。 I would like to know if it is possible to install node.js on my server.我想知道是否可以在我的服务器上安装 node.js。

I already tried to install it one week ago but I failed.一周前我已经尝试安装它,但我失败了。 The downloading and extraction worked, so the folder is on my server.下载和提取工作正常,所以文件夹在我的服务器上。 I did :我做了:

cd ~
wget http://nodejs.org/dist/latest/node-v11.1.0.tar.gz
tar xvf node-v11.1.0.tar.gz
mv node-v11.1.0 nodejs

But this part failed :但这部分失败了:

cp nodejs/bin/node ~/bin
cd ~/bin
ln -s ../nodejs/lib/node_modules/npm/bin/npm-cli.js npm

On the first instruction, there is an error : cp : cannot stat 'nodejs/bin/node': No such file or directory在第一条指令上,有一个错误:cp : cannot stat 'nodejs/bin/node': No such file or directory

I tried this too :我也试过这个:

cd nodejs
./configure
make
make install

(All instructions are from tutorials) (所有说明均来自教程)

The instructions are you following are for a precompiled bundle for Linux.您所遵循的说明适用于 Linux 的预编译包。

http://nodejs.org/dist/latest/node-v11.1.0.tar.gz is the URL to a source code bundle. http://nodejs.org/dist/latest/node-v11.1.0.tar.gz源代码包的 URL。

Download the compiled bundle for your system instead.而是为您的系统下载已编译的包。

Your best bet may be to look for distribution-specific instructions.您最好的选择可能是寻找特定于发行版的说明。 Most modern package managers will have an install option for Node and there are great options 3rd parties like Nodesource as well.大多数现代包管理器都有一个 Node 安装选项,还有像 Nodesource 这样的 3rd 方的很好的选择。

For instance, here's a DO howto for installing on Ubuntu 18.04 .例如, 这是在 Ubuntu 18.04 上安装的 DO howto It lists 3 different methods for install, each of which would work from an SSH session.它列出了 3 种不同的安装方法,每种方法都可以在 SSH 会话中运行。

If you let us know what distribution and version you are running, we may be able to help you more specifically.如果您让我们知道您正在运行的发行版和版本,我们可能会更具体地为您提供帮助。

If you don't know, you can try one of these commands to check:如果您不知道,可以尝试以下命令之一来检查:

$ hostnamectl

or或者

$ less /etc/issue

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM