在centOS上安装Node

来源:互联网 发布:物流管理信息系统软件 编辑:程序博客网 时间:2024/05/28 09:32

https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-a-centos-7-server

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.


原创粉丝点击