As I have been saying in other posts, web technologies are a predominant market among developers. Therefore, all knowledge of this nature is focused on providing applications for the web. Some of these technologies is NodeJS. So, in this article, you will learn how to install NodeJS on a CentOS 7 server.
One of the most powerful reasons that make NodeJS very popular is that it allows applications to make a large number of connections to the server without losing performance. In short, scalability and performance are its main characteristics.
So, let’s install NodeJS.
Many roads, same destination
To install NodeJS we have two recommended and simple ways in our CentOS 7 server.
The first is to use the EPEL repository. This repository, which is almost mandatory for CentOS 7 users, also has updated versions of NodeJS in its packages.
The other is to do it using the Node Version Manager. This method has one advantage and that is that it allows us to install a specific version of NodeJS.
I’ll show you how to do it with both methods.
1. Install NodeJS using EPEL Repository
As I said before, you can install NodeJS on CentOS 7 using the EPEL repository. It’s really simple so let’s go for it.
Access the server and write the following:
:~$ su :~# yum install epel-release
Now, install the NodeJS package.
:~# yum install nodejs
After that, check the installed version.
:~# nodejs -v
NPM is the NodeJS package manager. You can also install it.
:~# yum install npm
And that’s it.
2. Install NodeJS using Node Version Manager
If you want to install a specific version of NodeJS, this method is for you. Doing it is very easy. Let’s go.
First, go to NVM’s GitHub site and check out their latest stable version. Then run this command.
:~# curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
At the time of writing this post, the latest stable version of NVM is 0.33.11.
:~# source ~/.bash_profile
Then, show the available versions of NodeJS.
:~# nvm list-remote
I will install the lastest.
:~# nvm install 11.4.0
Next, check the NodeJS version.
:~# node --version
And that’s it.
As we have seen, installing NodeJS using the EPEL repository is really simple, but it doesn’t bring us an updated version of it. However, using NVM we can choose which version to install.
Please share this post with your friends.