https://www.vultr.com

The Everywhere Cloud

Deploy an instance.
Accelerate your application.


Installing Node.js on Linux


Node.js is a runtime environment that allows JavaScript to be executed directly on the operating system. This enables the use of JavaScript to develop server-side applications.

In some Linux distributions, the Node.js implementation may not be properly maintained and may lag from the releases of its official website. The following procedure shows how to manually acquire and install Node.js in order to have the most recent packages.

==========

1. Download the desired Node.js version.

1.1. Node.js x64 and other 64-bit Long-term Support (LTS)

user@host: $ wget https://nodejs.org/dist/v[ersionNum]/node-v[ersionNum]-linux-[CPU64].tar.xz
user@host: $ tar -xf node-v[ersionNum]-linux-[CPU64].tar.xz
user@host: $ cd node-v[ersionNum]-linux-[CPU64]

1.2. Node.js x64 and other 64-bit previous LTS

user@host: $ wget https://nodejs.org/download/release/latest-v[ersionMaj].x/node-v[ersionNum]-linux-[CPU64].tar.xz
user@host: $ tar -xf node-v[ersionNum]-linux-[CPU64].tar.xz
user@host: $ cd node-v[ersionNum]-linux-[CPU64]

1.3. Node.js x86 and other 32-bit Unofficial Builds

user@host: $ wget https://unofficial-builds.nodejs.org/download/release/v[ersionNum]/node-v[ersionNum]-linux-[CPU].tar.xz
user@host: $ tar -xf node-v[ersionNum]-linux-[CPU].tar.xz
user@host: $ cd node-v[ersionNum]-linux-[CPU]

2. Copy the Node.js files to the corresponding directories.

2.1. Users with sudo privileges.

user@host: $ sudo cp -R bin/* /usr/local/bin
user@host: $ sudo cp -R include/* /usr/local/include
user@host: $ sudo cp -R lib/* /usr/local/lib
user@host: $ sudo cp -R share/* /usr/local/share

2.2. Users without sudo privileges.

user@host: $ mkdir ~/.local/bin
user@host: $ mkdir ~/.local/include
user@host: $ mkdir ~/.local/lib
user@host: $ mkdir ~/.local/share

user@host: $ cp -R bin/* ~/.local/bin
user@host: $ cp -R include/* ~/.local/include
user@host: $ cp -R lib/* ~/.local/lib
user@host: $ cp -R share/* ~/.local/share

user@host: $ exit

2.2.1. When the user logs in or opens a terminal again, the directory [ ~/.local/bin ] will be automatically included in the $PATH environment variable.

3. Check if Node.js is properly installed.

user@host: $ node -v
user@host: $ npm -v
user@host: $ npm version

==========

Comments

Popular posts from this blog

Enabling HTTPS in Home Assistant

Configuring the FreeBSD Firewall with IPFW

Running Home Assistant on FreeBSD Servers