Distributions: Support RHEL8 / CentOS 8 / UBI

Created on 9 May 2019  路  21Comments  路  Source: nodesource/distributions

Hi,

RHEL8 is out and with RHEL8 Redhat announce the availability of Universal Base Images.

https://www.redhat.com/en/blog/introducing-red-hat-universal-base-image

Running curl -sL https://rpm.nodesource.com/setup_12.x | bash - on such a base image will give this output:

which: no tput in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)

## Installing the NodeSource Node.js 12.x repo...


## Inspecting system...

+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release
+ uname -m

## Confirming "el8-x86_64" is supported...

+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_12.x/el/8/x86_64/nodesource-release-el8-1.noarch.rpm'

## Your distribution, identified as "redhat-release-8.0-0.44.el8.x86_64", is not currently supported, please contact NodeSource at https://github.com/nodesource/distributions/issues if you think this is incorrect or would like your distribution to be considered for support

Most helpful comment

@jkroepke @pedrofurtado @geerlingguy @chrispoupart this is now fixed, it will work with python or python2.

Only consideration for EL8:

As yum will try to install Node.js from the AppStream repository (by default) instead 
of the NodeSource repository, the AppStream's version of Node.js has to be disabled.

This is done automatically by the setup script (as of #997).

All 21 comments

It doesn't look like there are RPMs for RHEL 8 yet, which is causing us headaches as we start to plan our migration to that platform.

Red Hat provides Node.js 8 and 10, but not 12 "yet".

It pains me to switch my images from RHEL to UBI, but still be stuck on UBI7 when I could otherwise be going to UBI8. This is one of the few pieces of software that I need that doesn't yet support RHEL 8.

@edsadr @kevinswiber Any news about this issue? :handshake: It will be great NodeJS latest version in CentOS 8 :tada:

@jkroepke EL8 is now supported!

curl -sL https://rpm.nodesource.com/setup_13.x | sudo bash -
sudo yum install -y nodejs

@igsu

the reason is that by default this distribution doesn't make python available

But to be honest, this is the best practice rule by python. See https://www.python.org/dev/peps/pep-0394/

It's possible to just depends agist python2? It also works in RHEL7.

Additionally, if you use #!/usr/bin/python somewhere, you should switch to #!/usr/bin/python2.

python2 is also available in ubuntu and macOS.

Where should I create an issue for this?

depending on python2 in RHEL8 is fairly poorly done.

On a fresh install of CentOS 8, running the following:

curl -sL https://rpm.nodesource.com/setup_13.x | bash -
sudo yum install -y nodejs

Doesn't result in any errors, but it installs Node.js 10.16.3 from the AppStream repository.

If I explicitly disable the AppStream repo, then I get the error:

yum install -y nodejs --disablerepo=AppStream

Error: 
 Problem: cannot install the best candidate for the job
  - nothing provides python >= 2.6 needed by nodejs-2:13.3.0-1nodesource.x86_64
  - nothing provides /usr/bin/python needed by nodejs-2:13.3.0-1nodesource.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

I tried installing python2:

sudo yum install -y python2

But still run into the error.

Then I tried to run the yumdownloader command, but got:

sudo: yumdownloader: command not found

This install process is very confusing, and nearly impossible to automate (I'm trying to get my Ansible role, which works for all other current OS distros I can test, to work with CentOS 8, and it's quite a pain right now... see https://github.com/geerlingguy/ansible-role-nodejs/issues/104).

Currently the only way to get this working (for me, on a minimal CentOS 8 install) is:

curl -sL https://rpm.nodesource.com/setup_13.x | bash -
sudo yum install -y python2 yum-utils
sudo yumdownloader nodejs --disablerepo=AppStream
sudo rpm -ivh --nodeps nodejs-13.3.0-1nodesource.x86_64.rpm

Finally I was able to install Node.js 13.3.0, sheesh.

@edsadr @kevinswiber Any news about this issue?

... and any alternative to yum-utils / yumdownloader?

There is no such packages on the Universal Base Images

@jkroepke Did you try dnf download nodejs to get the rpm?

Hello,

On my side, I was able to install nodejs-12.14.0 using buildpkg/centos:8 Docker image with following procedure:

yum install python3 -y
curl -sL https://rpm.nodesource.com/setup_12.x | bash
dnf download nodejs --disablerepo=AppStream
rpm -ivh --nodeps nodejs-12.14.0-1nodesource.x86_64.rpm

Python2 doesn't seem to be a requirement.

Python2 doesn't seem to be a requirement.

is python2 just required for node-gyp? node-gyp should not be required for a pure runtime image.

If yes it should be great to split node-gyp out of the node package and reduce image overhead in runtime images.

Until then I use a multistage docker build to get the rpm first and copy them to the second image to get an minimal footprint

https://github.com/adorsys/dockerhub-pipeline-images/blob/master/node/ubi/12/Dockerfile#L4

is python2 just required for node-gyp?

afaik yes

@jkroepke @pedrofurtado @geerlingguy @chrispoupart this is now fixed, it will work with python or python2.

Only consideration for EL8:

As yum will try to install Node.js from the AppStream repository (by default) instead 
of the NodeSource repository, the AppStream's version of Node.js has to be disabled.

This is done automatically by the setup script (as of #997).

Great!

One question! RHEL 8 supports weak dependencies. Did you consider to add python as weak dependencies since this is optional for runtime environments?

By default weak dependencies are installed unless the user disable it. It should be backwards compatible.

It looks like I can finally get things installed, though I have to manually run the following to disable the module in AppStream:

yum module disable -y nodejs

(In my case, I'm not using the install script.)

After that, and installation, it seems things are working correctly now!

[root@instance /]# node --version
v12.14.1

FYI: RHEL 8.1 and CentOS 8.1 include Node 12 per default

sudo dnf module enable nodejs:12
sudo dnf install nodejs

@igsu Is there any solution for this? 馃

@igsu Is there any solution for this? 馃

https://github.com/nodesource/distributions/issues/845#issuecomment-575316571

Trying to install node v8 on CentOS 8 results in the same error as #845 (comment)

# curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -
# yum install nodejs --disablerepo=AppStream
Last metadata expiration check: 0:12:52 ago on Thu Mar  5 16:41:29 2020.
Error: 
 Problem: cannot install the best candidate for the job
  - nothing provides python >= 2.6 needed by nodejs-2:8.17.0-1nodesource.x86_64
  - nothing provides /usr/bin/python needed by nodejs-2:8.17.0-1nodesource.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

# python2 --version
Python 2.7.16

Tried doing this and it kept installing node 10.0 instead. Not entirely easy, but I managed to solve it with:

yum module disable -y nodejs
curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
sudo yum install -y nodejs

Had this issue for a long time. A bit disappointed to be honest that this has continued for this long without proper fixing. Am at least happen that I have it working.

Was this page helpful?
0 / 5 - 0 ratings