In this tutorial, we will explain how to install NodeJS and what you need to consider when deploying the application on Clouding servers.
Installing NodeJS
For Ubuntu and Debian:
apt-get install build-essentialNodeJS v13.x
curl -sL https://deb.nodesource.com/setup_13.x | bash -
apt-get install nodejsNodeJS v12.x
curl -sL https://deb.nodesource.com/setup_12.x | bash -
apt-get install nodejsNodeJS v10.x
curl -sL https://deb.nodesource.com/setup_10.x | bash -
apt-get install nodejsFor CentOS and AlmaLinux:
yum install gcc-c++ make
# or alternatively: yum groupinstall 'Development Tools'NodeJS v13.x
curl -sL https://rpm.nodesource.com/setup_13.x | bash -
yum install nodejsNodeJS v12.x
curl -sL https://rpm.nodesource.com/setup_12.x | bash -
yum install nodejsNodeJS v10.x
curl -sL https://rpm.nodesource.com/setup_10.x | bash -
yum install nodejsDeploying the NodeJS application
Generally, many of you will use a Git repository to download the project, so installing the required package is recommended:
# For Ubuntu and Debian
apt install git
# For CentOS and AlmaLinux
yum install gitThen we can clone the repository with Git, using a command such as:
git clone https://example.com/repositorio_a_clonar.gitNext, we need to install our project's dependencies, so we will need to run the following:
npm installAnd finally, we can run our application with NodeJS
node appWith this, we will have a NodeJS application up and running and listening on the default port, which is usually 3000.
Opening a port in the Firewall
Since the NodeJS application listens on port 3000, you need to enable this port in your server's Firewall profile. If you do not know how to do this, you can review this tutorial on how to create Firewall rules.
We should have something similar to this:
This way, you will have access to port 3000 from your browser.