How to install NodeJS on CentOS 7?

0
520
NodeJS

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.

NodeJS is a runtime environment for server-side web applications. In other words, it is to achieve the implementation of JavaScript but on the server side and performing more advanced processes.

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
1.- Enabling the EPEL repository
1.- Enabling the EPEL repository

Now, install the NodeJS package.

:~# yum install nodejs
2.- Install NodeJS
2.- Install NodeJS

After that, check the installed version.

:~# nodejs -v
3.- Checking the installed version
3.- Checking the installed version

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
4.- Downloading NVM script
4.- Downloading NVM script

At the time of writing this post, the latest stable version of NVM is 0.33.11.

:~# source ~/.bash_profile
5.- Making NVM available for your user
5.- Making NVM available for your user

Then, show the available versions of NodeJS.

:~# nvm list-remote
6.- All NodeJS version available to download
6.- All NodeJS version available to download

I will install the lastest.

:~# nvm install 11.4.0
7.- Install NodeJS using NVM
7.- Installing NodeJS using NVM

Next, check the NodeJS version.

:~# node --version
8.- NodeJS installed
8.- NodeJS installed

And that’s it.

Conclusion

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.

LEAVE A REPLY

Please enter your comment!
Please enter your name here