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
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
Then, install NodeJS by running the following command:
:~# dnf install nodejs
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
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
For example, I will install the latest version.
:~# nvm install 12.7.0
Once the process is finished, check the installed version.
:~# node -v
And that is it.
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.