Node js kali linux install

Install Node.js and NPM Kali Linux [Step-by-Step]

Table of Contents

What is Node.js

Node.js is an open-source environment that enables you to use Javascript on the server-side. It’s also a cross-platform language available for Windows, Linux, FreeBSD, macOS, and other platforms. Before Node.js came into the web development world, Javascript was mainly used to create a frontend for websites, web applications, and handling users interactions. Previously, the most popular languages used to manage server requests were PHP and ASP (and are still used today). The main difference between PHP or ASP and Node.js is how they handle file requests.

How PHP or ASP Handles a File Request

Let’s look at how PHP or ASP would handle a file request.

  • The request is sent to the file system of the computer.
  • Waits for the file system to open and read the file.
  • Return the results to the client
  • Ready to take on the subsequent request.

How Node.js Handles a File Request

Here’s how Node.js handles a file request

  • The request is sent to the file system of the computer.
  • Ready to take on the subsequent request.
  • Return the results to the client after reading and opening the file.

You can see Node.js eliminates the waiting time before handling the subsequent request.

What is NPM

NPM, on the other hand, stands for Node Package Manager. NPM is two things: An online platform and a Command-Line tool. The online platform allows users to share and publish various tools written in Javascript. If you have worked with NPM before, these are the tools that you download as modules in your projects. The tools can be used in Browser (Front End), Server (Back End), or Command-Line (CLI).

NPM as a command-line tool enables users to interact with the NMP online platform. Here are some of the things you can do with the NPM command-line tool.

  • Install and uninstall packages
  • Version management: Ensures each package on your system is up to date with the latest release of the package on the online platform.
  • Dependency management

This post will give you a detailed guide on installing Node.js and NPM on Kali Linux. There are two ways which you can use to install Node.js and NPM on Kali Linux.

  1. By adding the Node.js repository
  2. By compiling Node.js source code

Method-1: Install Node.js From Repository

Repositories on Linux are online storage locations where users can download and update packages. Adding a particular repository to your Kali Linux system lets you download the specified package using the APT command. Although, we don’t necessarily need to add the Node.js repo to our system since it’s already present on the Kali Linux official repositories.

However, there is a catch! The Node.js package present on Kali Linux repositories is version 12, yet newer releases like version 14 are available for download. To solve that, we will add our repositories to download the latest Node.js version. Follow the steps below.

Step 1: Add Node.js Repository

Execute the command below on your terminal.

Sample Output:

Step 2: Update System

After adding the node repository, run the update command below to flush the system’s repository cache. That lets the system know you have added a new repository.

Step 3: Install Node.js Version 14 on Kali Linux

Up to this point, we have everything present on our system to download and install the latest version of Node.js and NPM. Execute the command below.

Читайте также:  Кабель лпт юсб для принтера

Sample Output:

Step 4: Check Node and NPM Versions

Tip: Node.js installer includes the NPM package manager. Therefore, by installing Node.js, you also install NPM.

To check the installed version of Node.js, run the command below.

To check the installed version of NPM, run the command below.

Sample Output:

Step 5: Remove Node.js and NPM

To uninstall Node.js and NPM from your system, run the command below:

Sample Output:

Источник

How to install npm and nodejs 14.x on Kali Linux

Node.js is a scripting language available to install not only on Kali Linux but for Windows, FreeBSD, macOS, and other common platforms. Whereas npm is a JavaScript programming language package manager that comes along with Node.js.

With Node.js, the popular JavaScript language has also found its way into server-side programming. Before Node.js, JavaScript was mainly responsible for the frontend and interaction with the visitor. It is quite flexible which means everything from small CLI (command line) tools to complex programs and independent HTTP servers can be developed using Nodejs.

In addition, no additional server is required for a Node.js application, as the application also represents the webserver. The fact that the server and client use the same programming language ( JavaScript ) is certainly another advantage for many users, as the entry barrier is correspondingly low, especially for web developers.

It comes with a number of built-in modules that are available without any further installation. And these modules can be easily installed using NPM, with the help of such modules we Node.js can also connect to a database (e.g. MySQL or MongoDB).

Install Nodejs 14.x and NPM on Kali Linux

There are two ways to install the latest version of node.js on kali Linux one is by adding its repository and the other by downloading the latest Debian packages of Nodejs manually from the official website. Here we will discuss both. You can use the below steps for Ubuntu 20.04, Linux Mint, Elementary OS, MX Linux, Debian, and other similar Linux distros.

Step 1: Add Nodejs 14.x LTS repository

Although there is no need to install the Nodejs repository on Kali Linux, as its packages are already present in the official repo of Kali Linux. However, the version available there is Nodejs 12.x, whereas the current LTS version is 14.x. Thus, those who want the latest version should add the below repo.

Step 2: Run system update

After adding the Nodejs 14 repo on Kali Linux run the system update command to flush the system’s repository cache and let it know that we have recently added something new.

Step 3: Install Node.JS 14 on Kali Linux

Everything we need to download the latest packages of Node.JS and NPM is in place, now it’s time to run the command to install this Javascript programming language.

Step 4: Check Version

Once the installation is completed check the version:

Источник

How to install Node.js in Kali Linux

Carlos Delgado

Learn how to install Node.js easily with a couple of commands in Kali Linux

Obtaining software directly from the source code is a common procedure on Unix computers, and generally involves the following three steps: configuring the makefile, compiling the code, and finally installing the executable to standard locations. In order to work with Node.js in Kali Linux, it’s recommendable to follow the mentioned process as it’s easier than other solutions.

Although Python is prefered when working with Kali Linux, both of the programming languages (Python and JavaScript) have the same end goals. There is no right or wrong decision for adopting which platform is best suited to you, therefore if you want to work with JavaScript instead of Python don’t feel bad about that. Besides, Node can be utilized in the broad range of modules, that means that you can use Python in your Node.JS application and viceversa.

Let’s get started with the installation !

Important

«Why should i create my own .deb of Node if i can download it from the website ? ñee, what a stupid post . » . As you know, Kali Linux is not a normal Linux distribution, therefore the available package publicly in the Node website may not work properly on it. You can try it it if you want, but to guarantee a correct functionality, just follow these steps and you should not have problems later.

1. Verify that you have all the required tools

To create your own .deb package of Node, you will need python and the compiler of c++ «g++». Execute the following command to install the required tools (if they’re already installed they should be only updated):

Читайте также:  Драйвера для принтера ricoh aficio sp 100su ddst

You may get a warning like «dpkg was interrupted, you must manually run ‘ sudo dpkg —configure -a ‘ to correct the problem». You just need, as mentioned, execute sudo dpkg —configure -a to solve it and then proceed with the command again.

Besides, if you are unable to install the checkinstall package (happens usually on recent installations of Kali Linux), proceed with the fix mentioned in this article in order to install the package correctly.

2. Create a temporary folder

You should create a temporary folder to generate the .deb package of Node.js. You can create it using mktemp, to make it with a single command execute the following instruction:

The -d argument indicates that mktemp should make a directory instead of a file. In this command we are creating a variable that contains the generated temporary path by mktemp and then switching to that directory in the terminal.

3. Download and extract Node.js

Download the distributable code of Node.js executing the following command in the terminal:

Once the download finishes, extract the content of the tar file with the following command:

This should create a folder with the preffix node-v that will vary according to the downloaded version of Node.js.

4. Run configure script

A configure script is an executable script designed to aid in developing a program to be run on a wide number of different computers. It matches the libraries on the user’s computer, with those required by the program before compiling it from its source code. Run the configure script with the following command:

5. Create Node .deb package compiling the code

To create our installable package of Node.js we are going to use CheckInstall for it. CheckInstall keeps track of all the files created or modified by your installation script and builds a standard binary package (.deb, .rpm, .tgz). CheckInstall is really useful if you’ve got a tarball with software that you have to compile (exactly what we’re doing in this moment).

To create the package of Node.js execute the following command:

Note that for most useful actions, checkinstall must be run as root. We’ll use fakeroot because as you may know, for security reason, it is a good idea to avoid doing as root everything that could be done as normal user, even if you can run sudo because it is your machine.

The command should start to compile Node.js and it will take a while, so relax, get a cola and wait.

6. Install Node generated package

Once the package is compiled, in the output of the previous step, you should receive a message that specifies the name of the generated .deb package:

In this case, the name of our package is node_7.7.2-1_amd64.deb , now we just need to install it using dpkg executing the following command:

Remember to replace the value of the i argument with the name of the generated package in the previous step.

Источник

Installing Node.js via package manager

Note: The packages on this page are maintained and supported by their respective packagers, not the Node.js core team. Please report any issues you encounter to the package maintainer. If it turns out your issue is a bug in Node.js itself, the maintainer will report the issue upstream.

Alpine Linux

Node.js LTS and npm packages are available in the Main Repository.

Node.js Current can be installed from the Community Repository.

Android

Android support is still experimental in Node.js, so precompiled binaries are not yet provided by Node.js developers.

However, there are some third-party solutions. For example, Termux community provides terminal emulator and Linux environment for Android, as well as own package manager and extensive collection of many precompiled applications. This command in Termux app will install the last available Node.js version:

Currently, Termux Node.js binaries are linked against system-icu (depending on libicu package).

Arch Linux

Node.js and npm packages are available in the Community Repository.

CentOS, Fedora and Red Hat Enterprise Linux

Node.js is available as a module called nodejs in CentOS/RHEL 8 and Fedora.

where corresponds to the major version of Node.js. To see a list of available streams:

For example, to install Node.js 12:

For CentOS/RHEL 7 Node.js is available via Software Collections.

Alternatives

These resources provide packages compatible with CentOS, Fedora, and RHEL.

Debian and Ubuntu based Linux distributions

Alternatives

Packages compatible with Debian and Ubuntu based Linux distributions are available via Node.js snaps.

Fast and simple Node.js version manager built in Rust used to manage multiple released Node.js versions. It allows you to perform operations like install, uninstall, switch Node versions automatically based on the current directory, etc. To install fnm, use this install script.

fnm has cross-platform support (macOS, Windows, Linux) & all popular shells (Bash, Zsh, Fish, PowerShell, Windows Command Line Prompt). fnm is built with speed in mind and compatibility support for .node-version and .nvmrc files.

Читайте также:  Картридж арагон 3 20bb гейзер 30056

FreeBSD

The most recent release of Node.js is available via the www/node port.

Install a binary package via pkg:

Or compile it on your own using ports:

Gentoo

Node.js is available in the portage tree.

IBM i

LTS versions of Node.js are available from IBM, and are available via the ‘yum’ package manager. The package name is nodejs followed by the major version number (for instance, nodejs12 , nodejs14 etc)

To install Node.js 14.x from the command line, run the following as a user with *ALLOBJ special authority:

Node.js can also be installed with the IBM i Access Client Solutions product. See this support document for more details

macOS

Download the macOS Installer directly from the nodejs.org web site.

If you want to download the package with bash:

Alternatives

Using Homebrew:

Using MacPorts:

Using pkgsrc:

Install the binary package:

Or build manually from pkgsrc:

n is a simple to use Node.js version manager for Mac and Linux. Specify the target version to install using a rich syntax, or select from a menu of previously downloaded versions. The versions are installed system-wide or user-wide, and for more targeted use you can run a version directly from the cached downloads.

See the homepage for install methods (boostrap, npm, Homebrew, third-party), and all the usage details.

If you already have npm then installing n and then the newest LTS node version is as simple as:

NetBSD

Node.js is available in the pkgsrc tree:

Or install a binary package (if available for your platform) using pkgin:

Nodenv

nodenv is a lightweight node version manager, similar to nvm . It’s simple and predictable. A rich plugin ecosystem lets you tailor it to suit your needs. Use nodenv to pick a Node version for your application and guarantee that your development environment matches production.

Nodenv installation instructions are maintained on its Github page. Please visit that page to ensure you’re following the latest version of the installation steps.

Node Version Manager is a bash script used to manage multiple released Node.js versions. It allows you to perform operations like install, uninstall, switch version, etc. To install nvm, use this install script.

On Unix / OS X systems Node.js built from source can be installed using nvm by installing into the location that nvm expects:

After this you can use nvm to switch between released versions and versions built from source. For example, if the version of Node.js is v8.0.0-pre:

Once the official release is out you will want to uninstall the version built from source:

Windows

The nvs version manager is cross-platform and can be used on Windows, macOS, and Unix-like systems

To install nvs on Windows go to the release page here and download the MSI installer file of the latest release.

You can also use chocolatey to install it:

macOS,UnixLike

You can find the documentation regarding the installation steps of nvs in macOS/Unix-like systems here

Usage

After this you can use nvs to switch between different versions of node.

To add the latest version of node:

Or to add the latest LTS version of node:

Then run the nvs use command to add a version of node to your PATH for the current shell:

To add it to PATH permanently, use nvs link :

OpenBSD

Node.js is available through the ports system.

Using pkg_add on OpenBSD:

openSUSE and SLE

Node.js is available in the main repositories under the following packages:

  • openSUSE Leap 15.2: nodejs10 , nodejs12 , nodejs14
  • openSUSE Tumbleweed: nodejs16
  • SUSE Linux Enterprise Server (SLES) 12: nodejs10 , nodejs12 , and nodejs14 (The «Web and Scripting Module» must be enabled.)
  • SUSE Linux Enterprise Server (SLES) 15 SP2: nodejs10 , nodejs12 , and nodejs14 (The «Web and Scripting Module» must be enabled.)

For example, to install Node.js 14.x on openSUSE Leap 15.2, run the following as root:

Different major versions of Node can be installed and used concurrently.

SmartOS and illumos

SmartOS images come with pkgsrc pre-installed. On other illumos distributions, first install pkgsrc, then you may install the binary package as normal:

Or build manually from pkgsrc:

Node.js snaps are available as node on the Snap store.

Solus

Solus provides Node.js in its main repository.

Void Linux

Void Linux ships Node.js stable in the main repository.

Windows

Download the Windows Installer directly from the nodejs.org web site.

Alternatives

Using Winget:

After running one of the two commands above, it may be necessary to restart the terminal emulator before the node CLI command becomes available.

Источник

Поделиться с друзьями
КомпСовет
Adblock
detector