Install nodejs10 on Ubuntu16
Open the official website: https://nodejs.org/en/download/
- Download the file in the red box below to the Ubuntu machine:
- The downloaded file is named node-v10.15.0-linux-x64.tar.xz, readers, your possible version is different from mine;
- Execute the command tar -xvf node-v10.15.0-linux-x64.tar.xz in the directory where node-v10.15.0-linux-x64.tar.xz is located to decompress and get the folder node-v10.15.0-linux-x64 , My full path here is: /usr/local/work/nodejs/node-v10.15.0-linux-x64;
- Open the /etc/profile file and add the following two lines at the end:
export NODEJS_HOME=/usr/local/work/nodejs/node-v10.15.0-linux-x64
export PATH=$PATH:$NODEJS_HOME/bin
- Execute the command source /etc/profile to make the setting effective;
- Execute the command node -v to check whether the settings are effective, as shown below, you can see the nodejs version number:
root@node-0:~# node -v
v10.15.0
So far, nodejs is installed successfully.