Node.js installation under CentOS7.x

1. Switch the directory to /usr/local/src

    Command line: cd /usr/local/src

2. Download node.js (I downloaded the binary source code here)

  Command line: wget https://nodejs.org/dist/v8.9.1/node-v8.9.1-linux-x64.tar.xz

3. Unzip the compressed package

  Command line: xz -d node-v8.9.1-linux-x64.tar.xz (there will still be tar files after decompression)

        Then execute the command line: tar -xvf node-v8.9.1-linux-x64.tar

Four: switch to the bin directory under the directory

  Command line: cd node-v8.9.1-linux-x64/bin/ (you can see node and npm)

  Execute the directory to view the node version: ./node -v

Five: Add environment variables (/etc/profile)

  Command line: vi /etc/profile (must be root user before executing this data)

       Save wq after adding!

  Execute another command: source /etc/profile The environment variable is modified

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325009243&siteId=291194637