Installing Node.js 18 on Ubuntu for All Users
1. Update Your Package List
sudo apt update2. Install the Required Dependencies
sudo apt install -y curl3. Add NodeSource Repository
NodeSource maintains Node.js binary distributions. To add the NodeSource repository for Node.js 18:
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -4. Install Node.js 18
sudo apt install -y nodejs5. Verify the Installation
node -v # verify Node.js version
npm -v # verify npm versionThese commands will install Node.js 18 and the associated npm package manager, making them available to all users on the system.