There are several ways to install Node.js on Ubuntu, and the best method depends on your specific needs. Here are three common methods: 1. **Using Apt from the Default Repositories** This method installs Node.js from Ubuntu's default software repositories. Note that this might not give you the latest version of Node.js. ```bash sudo apt update sudo apt install nodejs sudo apt install npm ``` Check the installed version with `node -v`. If the version is not suitable, consider the other methods [0]. 2. **Using Apt with a NodeSource PPA** This method allows you to install a different version of Node.js using a Personal Package Archive (PPA) maintained by NodeSource. This PPA often has more versions of Node.js available than the official Ubuntu repositories. First, download the installation script for your preferred version (replace `16.x` with your preferred version string): ```bash cd ~ curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh ``` Inspect the contents of the downloaded script and, if it's safe to run, execute the script: ```bash nano /tmp/nodesource_setup.sh sudo bash /tmp/nodesource_setup.sh ``` Finally, install Node.js: ```bash sudo apt install nodejs ``` Verify the installed version with `node -v` [0]. 3. **Using the Node Version Manager (NVM)** NVM allows you to install and manage multiple versions of Node.js. This method is recommended if you are actively developing Node applications and need to switch between Node versions frequently. First, install NVM: ```bash curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash ``` Close your terminal and reopen it, then verify the installation with `nvm --version`. Now, you can install Node.js: ```bash nvm install node # "node" is an alias for the latest version ``` Verify the installed version with `node -v` [2]. Remember to replace the version numbers in the commands with the version you wish to install.