logo
. . .

A Step-by-Step Guide on Installing Node.js on CyberPanel

Step 1: Access Your CyberPanel Dashboard

Begin by logging into your CyberPanel dashboard. Ensure that you have the necessary credentials and access rights to make server-level changes.

Step 2: Navigate to ‘Terminal’

Once logged in, locate the ‘Terminal’ option in your CyberPanel dashboard. This is where we’ll execute the commands to install Node.js.

Step 3: Update the Server

Before installing Node.js, it’s essential to update your server to ensure you have the latest packages. Execute the following command:

sudo yum update

This command will update all the installed packages on your server.

Step 4: Install Node.js Using NVM (Node Version Manager)

Node Version Manager (NVM) is a handy tool that allows you to manage multiple Node.js versions on your server. Install NVM by running the following commands:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

After the installation, close and reopen your terminal or run:

source ~/.bashrc

Step 5: Verify NVM Installation

Ensure NVM is installed correctly by checking its version:

nvm --version

This command should return the version number, confirming the successful installation.

Step 6: Install Node.js

Now that NVM is in place, you can easily install Node.js. Run the following command to install the latest LTS version:

nvm install --lts

This command installs the Long-Term Support (LTS) version of Node.js.

Step 7: Verify Node.js Installation

Confirm that Node.js is installed by checking its version:

node --version

This command should display the version number of the Node.js runtime.

Step 8: Install npm (Node Package Manager)

npm is the default package manager for Node.js. Install it by running:

npm install -g npm

This command installs npm globally on your system.

Step 9: Test Node.js and npm

Create a simple test file, for example, test.js, with the following content:

javascript
console.log("Node.js is installed and working!");

Execute the file using the command:

node test.js

If everything is set up correctly, you should see the output: “Node.js is installed and working!”