Software & AppsOperating SystemLinux

How To Install NodeJS 6.11.3 on Ubuntu Server Without Using NVM

Ubuntu 20

In this tutorial, we will guide you through the process of installing Node.js v6.11.3 on an Ubuntu Server without using Node Version Manager (NVM). Node.js is an open-source, cross-platform JavaScript runtime environment that allows developers to build server-side and networking applications.

Prerequisites

Before starting, ensure that you have:

  • A Ubuntu Server
  • Sudo or root privileges

Step 1: Download Node.js Tarball

The first step is to download the Node.js tarball for the version you want to install. In this case, we will download Node.js v6.11.3. You can download this version directly from the official Node.js website here. Look for the file node-v6.11.3-linux-x64.tar.gz.

Step 2: Transfer the Tarball to your Ubuntu Server

Next, you need to transfer the downloaded tarball to your Ubuntu Server. You can use tools like scp or wget to accomplish this. If you have the tarball on your local machine and want to transfer it to the server, you can use the scp command:

scp /path/to/node-v6.11.3-linux-x64.tar.gz user@server_ip:/path/on/server

In this command, replace /path/to/ with the path where you downloaded the tarball, user@server_ip with your username and server IP address, and /path/on/server with the location where you want to place the tarball on the server.

Step 3: Connect to your Ubuntu Server

Now, connect to your Ubuntu Server using SSH. You can do this using the following command:

ssh user@server_ip

Replace user@server_ip with your own server details.

Step 4: Extract the Node.js Tarball

After successfully connecting to your server, create a directory to extract the Node.js tarball:

sudo mkdir -p /opt/nodejs

This command creates a new directory named nodejs in the /opt/ directory. The -p flag tells mkdir to create parent directories as needed.

Next, extract the contents of the tarball into the newly created directory:

sudo tar -xvzf /path/on/server/node-v6.11.3-linux-x64.tar.gz -C /opt/nodejs/

The tar command is used to manipulate tarball files. The -x flag tells tar to extract, -v to display the progress in the terminal, -z to decompress the archive using gzip, -f to use archive file, and -C to change to the specified directory before performing any operations.

Step 5: Rename the Extracted Directory

For easier management, rename the extracted directory to a simpler name:

sudo mv /opt/nodejs/node-v6.11.3-linux-x64 /opt/nodejs/6.11.3

The mv command is used to move or rename files and directories.

Step 6: Create Symbolic Links

Create a symbolic link named current to the version you just installed:

sudo ln -s /opt/nodejs/6.11.3 /opt/nodejs/current

Then, create a symbolic link to the Node.js binary in a directory included in the system’s PATH:

sudo ln -s /opt/nodejs/current/bin/node /usr/local/bin/node

The ln command is used to create links between files and directories. The -s flag tells ln to create a symbolic link.

Step 7: Verify the Installation

Finally, verify that Node.js is installed correctly by checking the version:

node -v

This should display v6.11.3, indicating that Node.js 6.11.3 is successfully installed on your Ubuntu Server.

Conclusion

In this tutorial, we walked through the process of installing a specific version of Node.js on an Ubuntu Server without using NVM. This method allows you to manage different versions of Node.js by creating symbolic links to the desired version. Happy coding!

Can I install Node.js v6.11.3 on a different Ubuntu version?

The installation process described in this tutorial is specific to Ubuntu Server. However, you can adapt the steps for other Ubuntu versions by downloading the appropriate tarball for your version from the official Node.js website.

Can I install multiple versions of Node.js using this method?

Yes, you can install multiple versions of Node.js by repeating the steps outlined in this tutorial for each version you want to install. Just make sure to give each version a unique directory name and update the symbolic links accordingly.

How do I uninstall Node.js installed using this method?

To uninstall Node.js, you can simply remove the symbolic links and the directory associated with the version you want to uninstall. For example, to uninstall Node.js v6.11.3, you would run the following commands:

sudo rm /usr/local/bin/node
sudo rm /opt/nodejs/current
sudo rm -rf /opt/nodejs/6.11.3

Please exercise caution when using the rm command, as it permanently deletes files and directories.

Can I use this method to install other versions of Node.js?

Yes, you can use this method to install other versions of Node.js. Simply replace the version number in the download link, file name, and extraction commands with the version you want to install. Remember to update the symbolic links accordingly.

Can I use this method on a non-Ubuntu Linux distribution?

While this tutorial is specifically written for Ubuntu Server, you can adapt the steps for other Linux distributions. The process of downloading the tarball, transferring it to your server, extracting it, and creating symbolic links should generally be the same. However, the specific commands and paths may vary depending on your distribution.

Leave a Comment

Your email address will not be published. Required fields are marked *