Node.js is a powerful, open-source JavaScript runtime environment that allows you to run JavaScript code outside the browser — making it ideal for building fast and scalable web applications. If you’re working on Ubuntu 22.04 dedicated server and want to get started with Node.js, this guide will walk you through the process of installing it step by step.
This is the simplest method, but it may not provide the latest version.
If you need the latest version of Node.js, consider the next method using NodeSource.
NodeSource provides up-to-date Node.js packages.
For example, to install Node.js v20.x:
This will install both node
and npm
.
This method is recommended if you want to manage multiple versions of Node.js.
Then restart your shell or run:
Or install a specific version:
Installing Node.js on Ubuntu 22.04 is easy, and you have several options depending on your needs:
Use the Ubuntu repository for a quick install.
Use NodeSource for the latest version.
Use NVM to manage multiple versions.
Whichever method you choose, you’ll be ready to start building powerful applications with Node.js in no time.