To complete this tutorial, you will need a server running CentOS 8. We will assume you are logged into this server as a non-root, sudo-enabled user. To set this up, see our Initial Server Setup for CentOS 8 guide.
Node.js is available from CentOS 8’s default AppStream software repository. There are multiple versions available, and you can choose between them by enabling the appropriate module stream. First list out the available streams for the nodejs module using the dnf command:
- sudo dnf module list nodejs
Name Stream Profiles Summarynodejs 10 [d] common [d], development, minimal, s2i Javascript runtimenodejs 12 common, development, minimal, s2i Javascript runtimeTwo streams are available, 10 and 12. The [d] indicates that version 10 is the default stream. If you’d prefer to install Node.js 12, switch module streams now:
- sudo dnf module enable nodejs:12
You will be prompted to confirm your decision. Afterwards the version 12 stream will be enabled and we can continue with the installation. For more information on working with module streams, see the official CentOS AppStream documentation.
Install the nodejs package with dnf:
- sudo dnf install nodejs
Again, dnf will ask you to confirm the actions it will take. Press y then ENTER to do so, and the software will install.
Check that the install was successful by querying node for its version number:
- node --version
v12.13.1Your --version output will be different if you installed Node.js 10 instead.
Note: both available versions of Node.js are long-term support releases, meaning they have a longer guaranteed window of maintenance. See the official Node.js releases page for more lifecycle information.
Installing the nodejs package should also install the npm Node Package Manager utility as a dependency. Verify that it was installed properly as well:

- npm --version





