Repository Manual Installation - nodesource/distributions GitHub Wiki

🚨 Announcement

We wish to notify our users that we will no longer release new versions in the previous repository. Commencing immediately, all future updates and versions will be published to the new repository. This move aims to enhance our development pipeline and ensure smoother updates' distribution. For a seamless transition, users will need to adjust certain configurations. We're grateful for your continued trust and cooperation.

⚡ Simplified Installation Using Scripts:

For a more straightforward and convenient installation, we highly recommend using the scripts available in the main README of the repository. These scripts automate the migration process, making it more efficient and less prone to errors.

However, if you prefer a manual approach or wish to understand the process in detail, the following guide is available:

🛠 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 "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
    
  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.