Topic navigation

Hello World - Node.js on RHEL 8

RHEL 8 setup

This Hello, World shows how to install and run a package on Red Hat Enterprise Linux 8. If you haven’t already, download and install RHEL 8, and register it with Red Hat Subscription Management. If you don’t already have a subscription, a no-cost developer subscription will be created for you when you download through developers.redhat.com.

Make sure you have the core Red Hat Enterprise Linux 8 development tools (make, git, gcc) installed. If you didn’t select Development Tools during installation, install them now:

Installing Node.js on RHEL 8

There are several profiles available for the Node.js package. The default is to install a common set of runtime packages. For developers, using the development profile installs the libraries that enable you to build dynamically loadable modules.

You can use a browser such as Firefox, to connect to the Node.js web server using the URL `http://localhost:8000/`. Alternatively, you can use `curl` in a different window/terminal tab:

$ curl http://localhost:8000/

Working with Appstreams

The first step is to see what modules are available the Applications Streams (appstream) repo:

$ sudo yum module list # list all available modules in appstream

Or, find just the modules named `nodejs`

$ sudo yum module list nodejs

From the output you can see that Node.js 10 is the default module to install, note the `[d]`. You could have simply typed the following to install the default nodejs module.

$ sudo yum module install nodejs

Or even, shorter using ‘@’:

$ sudo yum install @nodejs

The above commands would have installed the nodejs with the default profile. A profile is group, usually a subset, of the packages in a module. For this module the default profile is named `default. In the steps above, the `development` profile was chosen to get the packages in the development profile installed.