Installing Node.js in AlmaLinux
To successfully install Node.js on AlmaLinux 9, you need to prepare your system in advance to avoid potential problems in the process. The first step is to update the current packages. To do this, open the terminal and run the command that will ensure that all installed programs are updated to the latest versions:dnf update
Installing Node.js using DNF from the AppStream repository
Installing Node.js using the DNF package manager from the AppStream repository is an easy and efficient way to start developing JavaScript applications. Open the terminal and check the list of available Node.js versions in the AppStream repository:dnf module list nodejs
You can install the desired version of Node.js using the `dnf module install nodejs:` command. For example:
dnf module install nodejs:20
DNF will automatically download the necessary dependencies and install Node.js on your system. Once the installation is complete, you can verify the success of the installation by checking the versions of Node.js and NPM installed. To do this, type in the terminal:
node -v
v20.17.0and
npm -v
10.8.2This allows you to make sure that all the necessary components are installed and ready to use. Installing via AppStream ensures that you get a stable and secure version of Node.js that is optimized for your system. Thus, with DNF you can easily and quickly set up a working environment for development, which will save you a lot of time and effort. Don't forget to update the packages regularly to get the latest patches and improvements.
Installing Node.js using Node Version Manager
Node Version Manager (NVM) is a powerful tool that makes it easy to install and manage Node.js versions on your computer. Using NVM not only simplifies version management, but also avoids conflicts between different projects. Thus, installing Node.js using NVM is the best solution for developers seeking flexibility and convenience in their work.You can read more about version control with NVM in our article Installing Node.js on Debian and Ubuntu.
Installing Node.js using the installer script
Installing Node.js using an installer script is one of the easiest and fastest ways to prepare your environment for development. First, you need to download the installer script from the official Node.js website. This script will automatically detect your operating system and suggest the appropriate version to install. Just open the terminal and execute the command to run the script:curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
Follow the on-screen instructions to complete the installation. It is important to note that when using the installer script, you will not only get Node.js itself, but also npm, a package manager that will greatly simplify the management of libraries and dependencies in your projects. Once the installation is complete, verify the success of the process by running the commands that will output the versions of the installed tools:node -v
npm -v
This makes sure your environment is fully ready for development. Installing Node.js using the installer script is an efficient way to quickly set up a working environment, which is especially important for developers looking to reduce time in the initial stages of a project.Installing Node.js on AlmaLinux from source
Installing Node.js on AlmaLinux from source is an important step for developers who want an up-to-date version of this popular platform for executing JavaScript code. First, you need to install the necessary dependencies such as gcc, make and other build tools, as well as the tar archiver, which can be installed via the dnf package manager. To install them, run the command:dnf install gcc make curl tar
Then download the latest version of Node.js from the official website, using the command:
wget https://nodejs.org/dist/v22.13.1/node-v22.13.1-linux-x64.tar.xz
After that, unzip the archive with:
tar xf node-v22.13.1-linux-x64.tar.xz
Next, the resulting files need to be copied to the system:
yes | cp -rf node-v22.13.1-linux-x64/{bin,include,lib,share} /usr/
Don't forget to check your installed version of Node.js and NPM using the commands below to make sure everything went well:
node -v
npm -v
Installing from source allows you to customize the configuration and optimize the performance of your application. By following these steps, you can easily install Node.js on AlmaLinux, giving you a stable and efficient development environment.
27 Jan 2025, 11:54:04