Installation Node.js on CentOS 8

Node.js is cross-platform, lightweight and very powerful Javascript runtime open-source for server-side programming is based on the engine V8 from Google and used to build scalable network projects and web applications that require backend functionality.

In this article we will tell you about the two different installation methods node.js on CentOS 8, then you will be able to start developing. All commands must be run by the root user with sudo privileges.

How to install Node.js in CentOS 8

First autoresume on behalf of the root user used the command:

su

1. Installing from the official repositories

The first method of installation about which we will tell you is to install node js from the official CentOS repositories. Before installing, you must list available for installing profiles using the following command:

yum list nodejs module

On this picture you can see that there are four different profiles, but you need to install only the default profile, which is highlighted with [d]. Now set a common set of runtime packages. To do this, run the command:

yum install nodejs module

Figure 4 shows the output from the install command.

If you are a developer, you can set a profile which will allow you to add additional libraries required for building dynamically loadable modules, as shown in the figure.

yum install nodejs module/development

After installing packages node.js you can check the version and location of files using the following commands:

node-v

npm -v

which node

which npm

It was the easiest way to install node environment. js on a CentOS 8 Linux from CentOS repository itself.

2. Install Node.js using NVM

Still have to install Node js CentOS 8 can be done using NVM, Node Version Manager is a script written in the bash programming language that allows you to install, remove and maintain multiple versions node.js in the system.

To install or update the NVM in CentOS 8, use one of the following commands curl or wget:

curl -o - https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash

Or:

wget-qO - https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash

In the above scenario, you install nvm centos home folder for your user. To start using it, you need to update your environment variables from .bash_profile.

source ~/.bash_profile

And after you create it, you can view the available versions node.js using the command ls-remote:

nvm list-remote

Is now possible to install Node.js CentOS 8 any version that you see in the list. For example, to get version v13.7.0, you can enter the following command:

nvm install 13.7.0

After installation is complete, you can enter a list of the installed versions node.js:

nvm ls

You can switch between versions of Node with nvm use, for example, for version v13.7.0:

nvm use v13.7.0

You can also install the version Node.js default and test it by running.

nvm alias default v13.7.0

Verify the installed version node.js you can perform the command given below:

node --version

Insights

In this article, we reviewed how to install Node.js on CentOS 8 from the official repositories or using a version Manager Node.js – NVM. The last option allows you to get the latest version of the program.

Source: losst.ru

(Visited 6 times, 1 visits today)