Last active
December 28, 2023 07:50
-
-
Save azlan/52ee8e4ef25528136e0e8dc198d7bae6 to your computer and use it in GitHub Desktop.
nodejs repo migration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/nodesource/distributions/wiki/How-to-migrate-to-the-new-repository (for bash) | |
# 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 | |
# Define the desired Node.js major version | |
set NODE_MAJOR 20 | |
# 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 | |
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment