From 7a877e8c9f16adf13b0b1266a43ecc9bc4108afb Mon Sep 17 00:00:00 2001 From: Chanaka Karunarathne Date: Mon, 25 Sep 2023 21:42:21 +0700 Subject: [PATCH] Update Debian & Ubuntu.md The nodesource script files are deprecated and no longer valid. So I added the latest method of installing nodejs given in their readme file. --- docs/installl-planka/Debian & Ubuntu.md | 27 +++++++++++-------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/docs/installl-planka/Debian & Ubuntu.md b/docs/installl-planka/Debian & Ubuntu.md index e90a724..c7989a5 100644 --- a/docs/installl-planka/Debian & Ubuntu.md +++ b/docs/installl-planka/Debian & Ubuntu.md @@ -86,27 +86,24 @@ Cloese the database with ### Nodejs -Installing Node.js with Apt Using a NodeSource PPA +Installing Node.js with Apt Using a [NodeSource](https://github.com/nodesource/distributions#nodejs) PPA ```bash -cd /tmp -sudo curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh -``` +# Download and import the Nodesource GPG key +sudo apt-get update +sudo apt-get install -y ca-certificates curl gnupg +sudo mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg - -You can inspect the contents of the downloaded script with nano (or your preferred text editor): -```bash -nano nodesource_setup.sh -``` - -Running third party shell scripts is not always considered a best practice, but in this case, NodeSource implements their own logic in order to ensure the correct commands are being passed to your package manager based on distro and version requirements. If you are satisfied that the script is safe to run, exit your editor, then run the script with sudo: -```bash -sudo bash nodesource_setup.sh +# Create deb repository +NODE_MAJOR=18 +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 ``` -Then run +Then run update and install ```bash -sudo apt install nodejs +sudo apt-get update +sudo apt-get install nodejs -y ``` Verify that you’ve installed the new version by running node with the -v version flag: