① 如何在CentOS 7服务器上安装NodeJS
你可以通过运行以下命令。
sudo yum install epel-release
现在可以使用yum命令安装Node.js了。
sudo yum install nodejs
因为在开发过程中我需要管理节点包,我还要安装新公共管理的软件包管理器,使用以下命令。
sudo yum install npm
② 如何在CentOS 7服务器上安装NodeJS
你可以通过运行以下命令。
1
sudo yum install epel-release
现在可以使用yum命令安装Node.js了。
1
sudo yum install nodejs
因为在开发过程中我需要管理节点包,我还要安装新公共管理的软件包管理器,使用以下命令。
1
sudo yum install npm
③ 如何在64位的CentOS6.4上安装及运行NodeJS应用
1、如果对nodejs环境有比较高的要求,建议选择源码安装的方式进行安装。
你可以到nodejs org官网上面找到相对的tar.gz文件包。
通过wget命令下载到centos服务器上, 然后进行源码安装。
2、如果对版本要求不高,可以直接用centos的包管理器yum进行安装
yum install nodejs npm
3、nodejs版本也可以通过nvm等工具去控制,期待深入研究。
④ 如何在centos下部署Node环境
下载并安装 Node.js
下载最新的稳定版 v6.10.3 到本地
wget https://nodejs.org/dist/v6.10.3/node-v6.10.3-linux-x64.tar.xz
下载完成后, 将其解压
tar xvJf node-v6.10.3-linux-x64.tar.xz
将解压的 Node.js 目录移动到 /usr/local 目录下
mv node-v6.10.3-linux-x64 /usr/local/node-v6
配置 node 软链接到 /bin 目录
ln -s /usr/local/node-v6/bin/node /bin/node
配置和使用 npm
配置 npm
npm 是 Node.js 的包管理和分发工具。它可以让 Node.js 开发者能够更加轻松的共享代码和共用代码片段
下载 node 的压缩包中已经包含了 npm , 我们只需要将其软链接到 bin 目录下即可
ln -s /usr/local/node-v6/bin/npm /bin/npm
配置环境变量
将 /usr/local/node-v6/bin 目录添加到 $PATH 环境变量中可以方便地使用通过 npm 全局安装的第三方工具
echo 'export PATH=/usr/local/node-v6/bin:$PATH' >> /etc/profile
生效环境变量
source /etc/profile
通过 npm 安装进程管理模块 forever
npm install forever -g
⑤ 如何在centos6上部署nodejs服务
1.首先你要有一台服务器:
系统:Linux (本人选用的是centos6,其它机器不成功不要怪我)
配置需求:至少是256M内存,(前辈们的血泪经验)
其它:随意
2.操作流程:
1,安装vncviewer远程可视化桌面(或者跳过这步,用FileZilla传文件什么的)2,安装nodejs环境3,安装mongodb3.24,安装git(可以不安装)
3.安装vncviewer桌面:
本地的直接下载客户端,支持所有电脑系统和手机端
使用putty链接远程服务器,然后执行以下安装脚本,
服务端一键安装脚本如下(看得懂的可以另行修改):
[VNC安装教程][1] https://segmentfault.com/a/1190000009666125
如果安装断开没关系,重新输入脚本,会继续安装,
安装成功后会提示输入两次密码,**记住这里的密码**
4.安装nodejs环境:
第1步 – 添加Node.js的Yum库
yum install -y gcc-c++ make
curl -sL https://rpm.nodesource.com/setup_6.x | sudo -E bash -
第2步 – 安装Node.js和NPM
yum install nodejs
第3步 – 检查Node.js和NPM版本
$ node -vv6.2.0$ npm -v3.8.9
5.安装mongodb数据库
注意:这里需要一些Linux和VIM命令操作,不懂的可以谷歌Linux vim
*在终端执行* vi /etc/yum.repos.d/mongodb-org-3.2.repo 命令(创建或打开该文件)*在mongodb-org-3.2.repo中输入*[mongodb-org-3.2] name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.2/x86_64/ gpgcheck=0
enabled=1
*用yum安装mongodb(如果没有写repo文件则不能用yum安装)*
sudo yum install -y mongodb-org*启动mongodb服务*
sudo service mongod start
6.安装git
yum -y install zlib-devel curl-devel openssl-devel perl cpio expat-devel gettext-devel openssl zlib autoconf tk perl-ExtUtils-MakeMaker
获取最新版 Git 源码包
从 https://github.com/git/git/releases 下载最新版的 zip 包或者 tar.gz 并解压:
以 tar.gz 格式为例(在网页的 tar.gz 上右键复制下载链接即可):
wget https://github.com/git/git/archive/v2.4.0.tar.gz
tar zxvf v2.4.0.tar.gz
会得到一个 git-2.4.0 的目录(版本号与下载的一致),然后进入这个目录:cd git-2.4.0 编译安装
autoconf
./configuremakemake install
以上4步请一步步来,以免出现错误不好找原因。
然后修改 /etc/ld.so.conf 文件,在最后加入一行:
/usr/local/lib
保存并关闭。
这就安装好了,看看版本:
git --versiongit version 2.4.0如果安装后报以下错误:
bash: /usr/bin/git: 没有那个文件或目录
那么请编辑 /etc/profile 在最后加入一行:
export PATH=$PATH:/usr/local/bin
然后重新开窗口就好了,或者执行命令 source /etc/profile 后就好了。
⑥ 如何在CentOS 7服务器上安装NodeJS
你可以通过运行以下命令。
1
sudo yum install epel-release
现在可以使用yum命令安装Node.js了。
1
sudo yum install nodejs
因为在开发过程中我需要管理节点包,我还要安装新公共管理的软件包管理器,使用以下命令。
1
sudo yum install npm
望采纳
⑦ 如何在CentOS 7服务器上安装NodeJS
Introction
Node.js is a Javascript platform for server-side programming. It
allows users to easily create networked applications that require
backend functionality. By using Javascript as both the client and server
language, development can be fast and consistent.
In this guide, we will show you a few different ways of getting
Node.js installed on a CentOS 7 server so that you can get started. Most
users will want to use the EPEL installation instructions or the NVM
installation steps.
Install Node from Source
One way of acquiring Node.js is to obtain the source code and compile it yourself.
To do so, you should grab the source code from the project’s website.
On the downloads page, right click on the “Source Code” link and click
“Copy link address” or whatever similar option your browser gives you.
On your server, use wget and paste the link that you copied in order to download the archive file:
wget http://nodejs.org/dist/v0.10.30/node-v0.10.30.tar.gz
Extract the archive and move into the new directory by typing:
tar xzvf node-v* && cd node-v*
There are a few packages that we need to download from the CentOS
repositories in order to compile the code. Use yum to get these now:
sudo yum install gcc gcc-c++
Now, we can configure and compile the software:
./configure
make
The compilation will take quite awhile. When it is finished, you can install the software onto your system by typing:
sudo make install
To check that the installation was successful, you can ask Node to display its version number:
node –version
v0.10.30
If you see the version number, then the installation was completed successfully.
Install a Package from the Node Site
Another option for installing Node.js on your server is to simply get
the pre-built packages from the Node.js website and install them.
You can find the Linux binary packages here. Since CentOS 7 only
comes in the 64-bit architecture, right click on the link under “Linux
Binaries (.tar.gz)” labeled “64-bit”. Select “Copy link address” or
whatever similar option your browser provides.
On your server, change to your home directory and use the wget
utility to download the files. Paste the URL you just copied as the
argument for the command:
cd ~
wget http://nodejs.org/dist/v0.10.30/node-v0.10.30-linux-x64.tar.gz
Note: Your version number in the URL is likely to be different than
the one above. Use the address you copied from the Node.js site rather
than the specific URL provided in this guide.
Next, we will extract the binary package into our system’s local
package hierarchy with the tar command. The archive is packaged within a
versioned directory, which we can get rid of by passing the
–strip-components 1 option. We will specify the target directory of our
command with the -C command:
sudo tar –strip-components 1 -xzvf node-v* -C /usr/local
This will install all of the components within the /usr/local branch of your system.
You can verify that the installation was successful by asking Node for its version number:
node –version
v0.10.30
The installation was successful and you can now begin using Node.js on your CentOS 7 server.
Install Node from the EPEL Repository
An alternative installation method uses the EPEL (Extra Packages for
Enterprise Linux) repository that is available for CentOS and related
distributions.
To gain access to the EPEL repo, you must modify the repo-list of
your installation. Fortunately, we can reconfigure access to this
repository by installing a package available in our current repos called
epel-release.
sudo yum install epel-release
Now that you have access to the EPEL repository, you can install Node.js using your regular yum commands:
sudo yum install nodejs
Once again, you can check that the installation was successful by asking Node to return its version number:
node –version
v0.10.30
Many people will also want access to npm to manage their Node packages. You can also get this from EPEL by typing:
sudo yum install npm
Install Node Using the Node Version Manager
Another way of installing Node.js that is particularly flexible is
through NVM, the Node version manager. This piece of software allows you
to install and maintain many different independent versions of Node.js,
and their associated Node packages, at the same time.
To install NVM on your CentOS 7 machine, visit the project’s GitHub
page. Copy the curl or wget command from the README file that displays
on the main page. This will point you towards the most recent version of
the installation script.
Before piping the command through to bash, it is always a good idea
to audit the script to make sure it isn’t doing anything you don’t agree
with. You can do that by removing the | bash segment at the end of the
curl command:
curl https//raw.githubusercontent.com/creationix/nvm/v0.13.1/install.sh
Take a look and make sure you are comfortable with the changes it is
making. When you are satisfied, run the command again with | bash
appended at the end. The URL you use will change depending on the latest
version of NVM, but as of right now, the script can be downloaded and
executed by typing:
curl https://raw.githubusercontent.com/creationix/nvm/v0.13.1/install.sh | bash
This will install the nvm script to your user account. To use it, you must first source your .bash_profile:
source ~/.bash_profile
Now, you can ask NVM which versions of Node it knows about:
nvm list-remote
. . .
v0.10.29
v0.10.30
v0.11.0
v0.11.1
v0.11.2
v0.11.3
v0.11.4
v0.11.5
v0.11.6
v0.11.7
v0.11.8
v0.11.9
v0.11.10
v0.11.11
v0.11.12
v0.11.13
You can install a version of Node by typing any of the releases you see. For instance, to get version 0.10.30, you can type:
nvm install v0.10.30
You can see the different versions you have installed by typing:
nvm list
-> v0.10.30
system
You can switch between them by typing:
nvm use v0.10.30
Now using node v0.10.30
To set this version as the default, type:
nvm alias default v0.10.30
default -> v0.10.30
You can verify that the install was successful using the same technique from the other sections, by typing:
node –version
v0.10.30
From the version number output, we can tell that Node is installed on our machine as we expected.
Conclusion
As you can see, there are quite a few different ways of getting
Node.js up and running on your CentOS 7 server. If one of the
installation methods is giving you problems, try one of the other
options.
⑧ 如何在CentOS 7服务器上安装NodeJS
你可以通过运行以下命令。
1
sudo yum install epel-release
现在可以使用yum命令安装Node.js了。
1
sudo yum install nodejs
因为在开发过程中我需要管理节点包,我还要安装新公共管理的软件包管理器,使用以下命令。
1
sudo yum install npm
⑨ 如何在CentOS 7服务器上安装NodeJS
你可以通过运行以下命令。 1 sudo yum install epel-release 现在可以使用yum命令安装Node.js了。 1 sudo yum install nodejs 因为在开发过程中我需要管理节点包,我还要安装新公共管理的软件包管理器,使用以下命令。 1 sudo yum install npm
⑩ 如何在CentOS/RHEL 7/6/上安装最新的Nodej和NPM
Node.js是一个建立在Chrome的JavaScript运行时的平台,用于轻松构建快速,可扩展的网络应用程序。 最新版本的node.js yum存储库由其官方网站维护。 我们可以将此yum存储库添加到我们的CentOS/RHEL 7/6系统中,并使用简单的命令安装node.js。
添加Node.js yum源
首先我们将在nodejs官方网站提供的系统中添加node.js yum库。您还需要开发工具来构建要在系统上安装的本机插件。
yum install -y gcc-c++ make
curl -sL https://rpm.nodesource.com/setup_6.x | sudo -E bash -
安装Node.js 和NPM
在您的系统中添加yum存储库后,可以安装Nodejs软件包。 NPM也将与node.js.一起安装。此命令还将在系统上安装许多其他相关软件包。
yum erase nodejs npm -y # 卸载旧版本的nodejsrpm -qa 'node|npm' | grep -v nodesource # 确认nodejs是否卸载干净yum install nodejs -y
检查Node.js和NPM版本
node -vnpm -v
创建演示Web服务器
这是一个可选的步骤。如果你想测试你的node.js安装。让我们创建一个带有“Welcome Node.js”文本的Web服务器。创建一个文件demo_server.js
vim demo_server.jsvar http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Welcome Node.js');
}).listen(3001, "127.0.0.1");
console.log('Server running at http://127.0.0.1:3001/');
现在使用以下命令启动Web服务器,建议把127.0.0.1改为本机ip
node --debug demo_server.js
Web服务器已经在端口3001上启动。现在在浏览器中访问http://127.0.0.1:3001/url