Detailed steps for installing nodejs environment and path configuration in Linux

Detailed steps for installing nodejs environment and path configuration in Linux

There are two ways to install nodejs in linux. One is simple, just unzip it and use it; the other is to download the source code, compile it, and install it through make and make install commands.

Here we only talk about the first one, which is simple and convenient. There is no need to execute make or make install. Here are the steps:

1. Determine the Linux system you are using, and then download the corresponding compressed package. Here I downloaded node-v6.11.2-linux-x64.tar.xz

2. Upload to the Linux related path, usually /usr/local/, and execute the following command

xz -d node-xxxx.tar.xz --- Extract tar.xz into a tar file

tar -xvf node-xxxx.tar --- Extract the tar file into a folder

mv node-xxx node ----Change the name of the folder to node

3. Check whether the installation is successful

4. Configure soft links so that node commands can be used globally

ln -s /usr/local/node/bin/node /usr/bin/node --map the node source file to the node file under usr/bin

ln -s /usr/local/node/bin/npm /usr/bin/npm

5. Configure the node file installation path

Enter the /usr/local/node/ path:

mkdirnode_global

mkdirnode_cache

npm config set prefix "node_global"

npm config set cache "node_cache"

6. When you feel that npm is slow, you can install cnpm

npm install cnpm -g --registry=https://registry.npm.taobao.org

By the way, you can check whether the global installation -g is installed in the node_global file according to the previous settings.

To use cnpm globally as follows, remember to configure a soft link.

This is the end of this article about installing nodejs environment and path configuration in Linux. For more relevant content about installing nodejs in Linux, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Install nodejs in binary mode under linux
  • Tutorial on installing nodejs & npm and configuring global paths in Linux Centos7.2
  • How to install nodejs and npm under linux

<<:  mysql IS NULL using index case explanation

>>:  How to write a picture as a background and a link (background picture plus link)

Recommend

What does mysql database do?

MySQL is a relational database management system....

How to force vertical screen on mobile pages

I recently wrote a mobile page at work, which was...

How to change the encoding to utf-8 in mysql version 5.7 under windows

Preface I just started learning MySQL and downloa...

A detailed introduction to seata docker high availability deployment

Version 1.4.2 Official Documentation dockerhub st...

Summary of common commands for Linux user and group management

This article summarizes the common commands for L...

Nginx location matching rule example

1. Grammar location [=|~|~*|^~|@] /uri/ { ... } 2...

An article to teach you HTML

If you are not committed to becoming an artist, t...

JavaScript to achieve calendar effect

This article shares the specific code for JavaScr...

How to configure Nginx to support ipv6 under Linux system

1. Check whether the existing nginx supports ipv6...

Implementation of running SQL Server using Docker

Now .net core is cross-platform, and everyone is ...

Detailed examples of Zabbix remote command execution

Table of contents one. environment two. Precautio...

Example of compiling LNMP in Docker container

Table of contents 1. Project Description 2. Nginx...

mysql having usage analysis

Usage of having The having clause allows us to fi...