Install NodeJS on CentOS 8 / RHEL 8 / Oracle Linux 8

0
36

A web server must be able to run many different applications or websites. Then, you have to install tools to run it. On the other hand, it is also possible that in a normal computer, we have to use those tools to create such applications. In this sense, NodeJS emerges as one of those tools that many developers use for their web applications. So, in this post, you will learn how to install NodeJS on CentOS 8, RHEL 8 and Oracle Linux 8. Whether you use the system as a web server or as your desktop operating system. In both cases, it is useful to install it.

NodeJS on CentOS 8, RHEL 8 and Oracle Linux 8

As is well known, NodeJS is an open-source technology that allows you to expand the functionality of web applications. Basically, it is a Javascript implementation on the server-side. Mainly used in applications where constant and asynchronous communication between client and server is required.

If you use CentOS 8, RHEL 8 or Oracle Linux 8 it is likely that you are either an application developer or sysadmin. In both cases, it is likely that you will have to serve web applications and it is better than the system has NodeJS installed for easy deployment.

1) Using the EPEL repository

We have two ways to install NodeJS on CentOS 8, RHEL 8 and Oracle Linux 8. The first is to enable the EPEL repository.

EPEL is a pretty reliable repository that allows you to install a lot of packages in the distribution. All this without any problems.

It opens a terminal and runs the following:

:~$ su
:~#  dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
1.- Enabling the EPEL repository on CentOS 8, RHEL 8 and Oracle Linux 8
1.- Enabling the EPEL repository on CentOS 8, RHEL 8 and Oracle Linux 8

Then, install NodeJS by running the following command:

:~# dnf install nodejs
2.- Install NodeJS on CentOS 8, RHEL 8 and Oracle Linux 8
2.- Install NodeJS on CentOS 8, RHEL 8 and Oracle Linux 8

Finally, check the installed version.

:~# node -v
v10.14.1

2) Install NodeJS on CentOS 8, RHEL 8 and Oracle Linux 8 using the NVM

The first method is quite reliable and we even get an LTS version. However, it is likely that we need to have the latest version available. Using NVM this is possible.

NVM (Node Version Manager) is a utility that allows you to install and manage different versions of NodeJS.

First, you have to install curl to download NVM.

:~# dnf install curl

Then, download and install NVM.

:~# :~# curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
3.- Install NVM on CentOS 8 RHEL 8 and Oracle Linux 8
3.- Install NVM on CentOS 8 RHEL 8 and Oracle Linux 8

Now, refresh the bash profile to use NVM.

:~# source ~/.bash_profile

Now you can list all versions of NodeJS available for download.

:~# nvm list-remote
4.- All nodeJS versions ready to be installed
4.- All nodeJS versions ready to be installed

For example, I will install the latest version.

:~# nvm install 12.7.0

Once the process is finished, check the installed version.

:~# node -v
5.- Node version
5.- Node version

And that is it.

Conclusion

As you can see Installing NodeJS is a simple process, especially for a technology quite powerful and used by many developers worldwide. We even have two ways to do it and it’s up to you to choose the best one.

If you want to install NodeJS in other systems like Debian or Ubuntu, you can check here.

Please share this post with your friends and join our Telegram channel.

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here