{"id":1002,"date":"2022-01-13T09:57:13","date_gmt":"2022-01-13T09:57:13","guid":{"rendered":"https:\/\/editjournal.redakt.eu\/faxmodem\/?p=1002"},"modified":"2022-01-13T13:22:22","modified_gmt":"2022-01-13T13:22:22","slug":"installing-node-js-on-a-low-end-vps","status":"publish","type":"post","link":"https:\/\/editjournal.redakt.eu\/faxmodem\/blog\/development\/experimental\/installing-node-js-on-a-low-end-vps\/","title":{"rendered":"Installing Node.js on a low end VPS"},"content":{"rendered":"<p>As a pre-requisite to installing GatsbyJS on a VPS, I needed it to run a compatible version of Node.js first<\/p>\n<pre><code>#!\/bin\/bash\n\n# General housekeeping\napt-get update\napt-get upgrade\n\n# Some minimal Debian distributions are too minimal\napt-get install --no-install-recommends curl apt-transport-https ca-certificates\n\n# Add the NodeSource package signing key\nKEYRING=\/usr\/share\/keyrings\/nodesource.gpg\ncurl -fsSL https:\/\/deb.nodesource.com\/gpgkey\/nodesource.gpg.key | gpg --dearmor | tee &quot;$KEYRING&quot; &gt;\/dev\/null\ngpg --no-default-keyring --keyring &quot;$KEYRING&quot; --list-keys\n\n# Replace with the branch of Node.js or io.js you want to install: node_6.x, node_8.x, etc...\nVERSION=node_14.x\n\n# The below command will set this correctly, but if lsb_release isn&#039;t available, you can set it manually:\n# - For Debian distributions: jessie, sid, etc...\n# - For Ubuntu distributions: xenial, bionic, etc...\n# - For Debian or Ubuntu derived distributions your best option is to use the codename corresponding to the upstream release your distribution is based off. This is an advanced scenario and unsupported if your distribution is not listed as supported per earlier in this README.\nDISTRO=&quot;$(lsb_release -s -c)&quot;\necho &quot;deb [signed-by=$KEYRING] https:\/\/deb.nodesource.com\/$VERSION $DISTRO main&quot; | tee \/etc\/apt\/sources.list.d\/nodesource.list\necho &quot;deb-src [signed-by=$KEYRING] https:\/\/deb.nodesource.com\/$VERSION $DISTRO main&quot; | tee -a \/etc\/apt\/sources.list.d\/nodesource.list\n\napt-get update\napt-cache policy nodejs\n\n# Consult the apt-cache policy output for a specific Node version, e.g.:\n#apt-get install nodejs=14.16.1-1nodesource1<\/code><\/pre>\n<p>Note: <a href=\"https:\/\/deb.nodesource.com\/node_16.x\/dists\/\">16.x<\/a> won't work on Debian 8 (Jessie), but <a href=\"https:\/\/deb.nodesource.com\/node_14.x\/dists\/\">14.x<\/a> will and shouldn't get EOL until <a href=\"https:\/\/nodejs.org\/en\/about\/releases\/\">well into 2023<\/a>.<\/p>\n<p>Heads up though: with 14, you'll probably run into <a href=\"https:\/\/github.com\/nodesource\/distributions\/issues\/1181\">signatures couldn't be verified because the public key is not available: NO_PUBKEY<\/a>. To solve,<\/p>\n<pre><code>curl -fsSL https:\/\/deb.nodesource.com\/gpgkey\/nodesource.gpg.key | apt-key add -<\/code><\/pre>\n<p>Sources:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/nodesource\/distributions\/blob\/1a2d4df80fa8cdd8b382188e25971e4196631acd\/README.md#manual-installation\">https:\/\/github.com\/nodesource\/distributions\/blob\/1a2d4df80fa8cdd8b382188e25971e4196631acd\/README.md#manual-installation<\/a><\/li>\n<li><a href=\"https:\/\/unix.stackexchange.com\/questions\/263801\/apt-get-fails-the-method-driver-usr-lib-apt-methods-https-could-not-be-found\">https:\/\/unix.stackexchange.com\/questions\/263801\/apt-get-fails-the-method-driver-usr-lib-apt-methods-https-could-not-be-found<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/nodesource\/distributions\/issues\/1181\">https:\/\/github.com\/nodesource\/distributions\/issues\/1181<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>If you have a VPS that runs Debian 8 or 9, here&#8217;s how you can install a relatively relevant Node.js version<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[811],"tags":[814,769,817],"class_list":["post-1002","post","type-post","status-publish","format-standard","hentry","category-experimental","tag-low-end-box","tag-node-js","tag-vps","entry"],"_links":{"self":[{"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/posts\/1002","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/comments?post=1002"}],"version-history":[{"count":5,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/posts\/1002\/revisions"}],"predecessor-version":[{"id":1019,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/posts\/1002\/revisions\/1019"}],"wp:attachment":[{"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/media?parent=1002"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/categories?post=1002"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/tags?post=1002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}