how to deploy node server on CPANEL? - node.js

I want to deploy node server over CPANEL how do i start?, I have searched but not relevant answer entertained me tell me solution if anyone did this.

How to install Node.js and NPM on cPanel Hosting Server
Node.js currently only works on servers running CentOS 6 or CentOS 7. To determine the CentOS version on your server, run this command:
uname -r
If the output from this command contains el6 (for example, 2.6.32-531.17.1.lve1.2.60.el6.x86_64) or el7 (for example, 3.10.0-714.10.2.lve1.5.12.el7.x86_64) , then your server is running CentOS 6 or CentOS 7. However, if you see el5h (for example, 2.6.32-531.23.3.lve1.2.66.el5h.x86_64), then your server is running CentOS 5 and does not support Node.js.
Download NodeJS. To make sure you’re in the root directory, run this command:
cd ~
wget https://nodejs.org/dist/latest/node-v10.15.0-linux-arm64.tar.gz
Extract the NodeJS Files:
tar xvf node-v10.15.0-linux-arm64.tar.gz
Now rename the folder to nodejs name, to do this type the following command:
mv node-v10.15.0-linux-x64 nodejs
Now install node and npm binaries, type the next commands:
mkdir ~/bin
cp nodejs/bin/node ~/bin
cd ~/bin 
ln -s ../nodejs/lib/node_modules/npm/bin/npm-cli.js npm
Node.js and npm are installed on your account. To verify, type the following commands:
node --version
npm --version
STOPPING A NODE.JS APPLICATION
To stop a currently running Node.js application, type the following command:
pkill node
This command immediately stops all running Node.js applications.

Related

How to apply Node.js secuirty updates?

How to apply node.js security patches?
Is there a specific process to apply security patches when using meteor js on ubuntu 16.04?
When you're running meteor in production mode, it is run as a (pure) node.js app. So the short answer to your question is to just update node (depending on how you installed it; probably sudo apt-get update -y && sudo apt-get install nodejs -y).
There are a variety of tools you can use to deploy a meteor app (e.g. meteor-up), but all of them have essentially the same two steps, which are easy enough to do yourself:
Bundle your meteor app into a node.js app
meteor build ../my-build-output-folder --server https://my.production.site.url --architecture os.linux.x86_64
This will create a meteor-server.tar.gz file in the folder you specified, containing the node.js app. The process is then (as per the README file that is included in the bundle):
Transfer the meteor-server.tar.gz file to your server
tar -zxvf meteor-server.tar.gz to extract the node application
The included README file tells you the rest :
README:
This is a Meteor application bundle. It has only one external dependency:
Node.js v8.11.4. To run the application:
$ (cd programs/server && npm install)
$ export MONGO_URL='mongodb://user:password#host:port/databasename'
$ export ROOT_URL='http://example.com'
$ export MAIL_URL='smtp://user:password#mailhost:port/'
$ node main.js
Use the PORT environment variable to set the port where the
application will listen. The default is 80, but that will require
root on most systems.
Set up a system to survive restarts e.g. upstart , pm2, supervisord , or docker

Nodejs or node returns nothing on Ubuntu

I've built a Javascript app running on Node within my MacOS environment, and everything works great. Now I've created an Azure Ubuntu server, rsync'd the source from my machine.
I've duplicated the app requirements by installing npm, node, and all the packages required. I SSH into the server and when I run the app from the Ubuntu server via
$node app.js
All that is returned is
$
Reading that Ubuntu uses nodejs-legacy, i've also tried
$nodejs app.js
Same result
$node -v
v4.7.2
I've also built a package.json file and when executing with
npm start
it immediately returns back to $.
The reason why it wasn't working is the default APT repository that is called when installing nodejs on Ubuntu is outdated. I ran the following to code to fix the problem. It automatically uninstalls all the other incorrect packages, sets the correct repository, and re-installs.
# Sets up the correct APT repository hosted by NodeSource, and adds the PGP key to the system's APT keychain
$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
# Installs Node.js
$ sudo apt-get install -y nodejs
# Updates NPM
$ sudo npm install npm --global
All apps work as intended now!

Update Parse Server on Ubuntu

I have my own Parse server running on an Ubuntu droplet on Digital Ocean. I'm pretty new to running my own backend. How do I check what version of Parse Server I'm running and how do I update it to the latest version?
Open terminal (command line tool), then use "cd" command to navigate to your parse-server-example directory: cd ...../parse-server-example/
Pull latest source code from github with command: git pull
Install packages and dependencies: npm install
Run it: npm run index.js
If you want your server keep running you can install and use forever.
Good luck!
You can look into the package.json file of parse-server .
Or you can just use npm list to list all packages and their dependencies with version .

Node http-server not working on Ubuntu linux

I am trying to run a simple http server in my project directory. All I need is GET request support, so I can GET html/css/js/etc.
For that I wanted to use http-server from npm.
I installed it with npm install http-server -g
Now I cd to my project folder where it has the index.html file, I open the terminal and run http-server
But when I open my browser at http://localhost:8080/index.html - it can't connect to the host.
Am I missing something?
Okay, the issue was - I had another package installed on Ubuntu, which is also called node
Node JS package is called nodejs on my system and I think that http-server is looking specifically for 'node'.
In order to work around this:
I removed the node package with sudo apt-get remove node and created a symlink for nodejs:
sudo ln -s /usr/bin/nodejs /usr/local/bin/node
First install npm.
Second npm install http-server -g.Next append after the http-server url template url like http-server C:\xampp\htdocs\

Deploying meteor.js app using `meteor`

I was thinking whether we can deploy Meteor.js app doing this:
curl https://install.meteor.com | /bin/sh
meteor create myApp
cd myApp
FTP app files into myApp directory
meteor
I assume you are trying to deploy to your own server. Therefore your need to create the bundle which you can them FTP and expand in your server/directory as follows:
create the bundle: meteor bundle myApp.tgz
FTP myApp.tgz into your server/directory.
Locate the uploaded tar file and extract it with the following command:
tar -zxvf nameofyourapp.tgz
Note: If the machine you developed the application is different than the machine you are deploying to, you will need to rebuild the native package. To do this, enter the bundle/programs/server/node_modules directory.
cd bundle/programs/server/node_modules
Once there remove the fibers directory
rm -r fibers
Rebuild fibers using npm:
npm install fibers
This will install the latest fibers version, specific to the platform you are deploying to.
Best regards,
Vince

Resources