Skip to content

Instantly share code, notes, and snippets.

@darklinden
Last active February 14, 2023 02:49
Show Gist options
  • Save darklinden/e6598c1819afd19da849ae4270c2bb17 to your computer and use it in GitHub Desktop.
Save darklinden/e6598c1819afd19da849ae4270c2bb17 to your computer and use it in GitHub Desktop.
How To Install Node.js 16 on CentOS 8 | CentOS 7

How To Install Node.js 16 on CentOS 8 | CentOS 7

from https://techviewleo.com/install-node-js-on-centos-linux/

  • Node.js packages are provided through the NodeSource Node.js Binary Distributions via .rpm. Add the repository to the system using the commands below:

    curl -fsSL https://rpm.nodesource.com/setup_16.x | sudo bash -

  • Tencent OpenCloudOS is not in the supported list

    You don't appear to be running a supported version of Enterprise Linux "opencloudos"

    curl -fsSL https://rpm.nodesource.com/setup_16.x -o setup_16.sh
    vi setup_16.sh

    change line

    if [[ $DISTRO_PKG =~ ^(redhat|centos|almalinux|rocky|cloudlinux|mageia|sl)- ]]; then

    to

    if [[ $DISTRO_PKG =~ ^(redhat|centos|almalinux|rocky|cloudlinux|opencloudos|mageia|sl)- ]]; then

    run the shell

    sh setup_16.sh

    You may need to clear the cache of pre-installed incorrect versions

    yum clean all

  • Once the repository has been configured on your CentOS server you can proceed to install Node.js 16 on CentOS 8 | CentOS 7:

    sudo yum install -y nodejs

  • If you need development tools to build native addons:

    sudo yum install gcc-c++ make

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment