In online articles, installing node.js under Linux is compiled using source code. In fact, node's github has provided a method to install node.js under each system using its own package manager.
1. In Ubuntu, use the following command:
The code copy is as follows:
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs
If you need to use npm to install local components, you also need to execute the following command:
The code copy is as follows:
apt-get install -y build-essential
2. In Debian, use the following command:
The code copy is as follows:
apt-get install curl
curl -sL https://deb.nodesource.com/setup | bash -
apt-get install -y nodejs
If you need to use npm to install local components, you also need to execute the following command:
The code copy is as follows:
apt-get install -y build-essential
3. In RHEL, Fedora, and CentOS, use the following commands:
The code copy is as follows:
curl -sL https://rpm.nodesource.com/setup | bash -
yum install -y nodejs
If you need to use npm to install local components, you also need to execute the following command:
The code copy is as follows:
yum groupinstall 'Development Tools'
#The following line is executed in Fedora
sudo yum install nodejs npm
#The following line is executed in RHEL and CentOS
sudo yum install nodejs npm --enablerepo=epel
However, in practice, in CentOS6,
The code copy is as follows:
sudo yum install nodejs npm --enablerepo=epel
An error will be reported without execution, and npm can also be used.
4. In openSUSE and SLE, use the following command:
The code copy is as follows:
sudo zypper ar /
http://download.opensuse.org/repositories/devel:/languages:/nodejs/openSUSE_13.1/ /
Node.js
sudo zypper in nodejs nodejs-devel
5. In Arch Linux, use the following command:
The code copy is as follows:
pacman -S nodejs
6. In FreeBSD and OpenBSD, use the following command:
The code copy is as follows:
/usr/ports/www/node
cd /usr/ports/www/node-devel/ && make install clean
#or
pkg_add -r node-devel
pkg install node
#or
pkg install node-devel
The above is all about this article, I hope you like it.