blog
blog copied to clipboard
Ubuntu install Node.js
References:
- https://github.com/nodesource/distributions/blob/master/README.md#debinstall
- https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04
$ cd ~
$ curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
$ sudo apt install nodejs
$ node -v
v16.13.0
$ npm -v
8.1.0
-fsSL
meaning:
References: https://curl.se/docs/manpage.html
- -f, --fail (HTTP) Fail silently (no output at all) on server errors. This is mostly done to enable scripts etc to better deal with failed attempts. In normal cases when an HTTP server fails to deliver a document, it returns an HTML document stating so (which often also describes why and more). This flag will prevent curl from outputting that and return error 22. This method is not fail-safe and there are occasions where non-successful response codes will slip through, especially when authentication is involved (response codes 401 and 407).
- -S, --show-error When used with -s, --silent, it makes curl show an error message if it fails.
- -s, --silent Silent or quiet mode. Do not show progress meter or error messages. Makes Curl mute. It will still output the data you ask for, potentially even to the terminal/stdout unless you redirect it. Use -S, --show-error in addition to this option to disable progress meter but still show error messages.
- -L, --location (HTTP) If the server reports that the requested page has moved to a different location (indicated with a Location: header and a 3XX response code), this option will make curl redo the request on the new place.
sudo -E bash -
meaning:
References: https://askubuntu.com/questions/891872/pipe-to-sudo-e-bash
It's a short way of executing a script without having to save the file and then execute it with root privileges.