Skip to content

Repository Manual Installation

DAVID WATSON edited this page Aug 15, 2026 · 6 revisions

https://github.com/nodesource/distributions.wiki.git

🛠 Configuration Steps:

Debian Systems:

  1. Remove Old Repository Configurations:

    # Remove the GPG keyring file associated with the old repository
    sudo rm /etc/apt/keyrings/nodesource.gpg
    # Remove the old repository's list file
    sudo rm /etc/apt/sources.list.d/nodesource.list
  2. Initialize the New Repository:

    # Define the desired Node.js major version
    NODE_MAJOR=18
    # Update local package index
    sudo apt-get update
    # Install necessary packages for downloading and verifying new repository information
    sudo apt-get install -y ca-certificates curl gnupg
    # Create a directory for the new repository's keyring, if it doesn't exist
    sudo mkdir -p /etc/apt/keyrings
    # Download the new repository's GPG key and save it in the keyring directory
    curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
    # Add the new repository's source list with its GPG key for package verification
    echo "Types: deb
    URIs: https://deb.nodesource.com/node_${NODE_MAJOR}.x/
    Suites: nodistro
    Components: main
    Signed-By: /etc/apt/keyrings/nodesource.gpg" | sudo tee /etc/apt/sources.list.d/nodesource.sources
  3. Install Node.js:

    # Update local package index to recognize the new repository
    sudo apt-get update
    # Install Node.js from the new repository
    sudo apt-get install -y nodejs

RPM-Based Systems:

  1. Remove Old Repository Configurations:

    # Remove the old repository's configuration files
    sudo rm /etc/yum.repos.d/nodesource*.repo
  2. Initialize the New Repository:

    # Define the desired Node.js major version
    NODE_VERSION=21.x
    SYS_ARCH=$(uname -m)
    # Install the new repository's RPM package
    NODEJS_REPO_CONTENT="[nodesource-nodejs]
    name=Node.js Packages for Linux RPM based distros - $SYS_ARCH
    baseurl=https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nodejs/$SYS_ARCH
    priority=9
    enabled=1
    gpgcheck=1
    gpgkey=https://rpm.nodesource.com/gpgkey/ns-operations-public.key
    module_hotfixes=1"
    # Write Node.js repository content
    echo "$NODEJS_REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nodejs.repo > /dev/null
  3. Install Node.js:

    # Install Node.js from the new repository
    sudo yum update -y
    sudo yum install nodejs -y

Should you need further assistance, feel free to contact our support team.

Clone this wiki locally