Nodejs is getting popularity as Javascript can be used as a complete stack and JS is the only language that you need to know before creating a web application. Yeah nothing else.
My requirements are like to install the nodejs in a unix based server, preferably centos or ubuntu. simple commands will help you to install nodejs. The following link will help you to install node perfectly to your centos system.
Please check this link
One of the issue that i faced just after installing the nodejs was my command prompt was not understanding the node or npm as commands. What i understood is that the installation was installing node and npm to /usr/local/bin/ location. But the command line understand the binaries in the /usr/bin location. So we need to map this using synlink.
ln -s /usr/local/bin/node /usr/bin/node
ln -s /usr/local/lib/node /usr/lib/node
ln -s /usr/local/bin/npm /usr/bin/npm
ln -s /usr/local/bin/node-waf /usr/bin/node-waf
This link will help you to understand the what is going on.
Now install express with npm and the same synlinking we need to do for each package that we create.
ln -s /usr/local/bin/express /usr/bin/express
ln -s /usr/local/bin/node-supervisor /usr/bin/node-supervisor
ln -s /usr/local/bin/supervisor /usr/bin/supervisor
ln -s /usr/local/bin/n /usr/bin/n
It will be good to go through this link before we start installing new packages. This will help you understand how to install a npm package.
n stable
it will be good if we install any daemon based package to manage our nodejs app. So it will take care of handling the nodejs instance running.
npm install forever
npm install forever-monitor
ln -s /usr/local/bin/forever /usr/bin/forever
Now you can start nodejs daemon in forever as -
forever start /tmp/node/UpgradeChecker/app/bin/www
If you want to make this as a custom service then check this link. If you do then you can start your app like,
service nodeapp start
My requirements are like to install the nodejs in a unix based server, preferably centos or ubuntu. simple commands will help you to install nodejs. The following link will help you to install node perfectly to your centos system.
Please check this link
One of the issue that i faced just after installing the nodejs was my command prompt was not understanding the node or npm as commands. What i understood is that the installation was installing node and npm to /usr/local/bin/ location. But the command line understand the binaries in the /usr/bin location. So we need to map this using synlink.
ln -s /usr/local/bin/node /usr/bin/node
ln -s /usr/local/lib/node /usr/lib/node
ln -s /usr/local/bin/npm /usr/bin/npm
ln -s /usr/local/bin/node-waf /usr/bin/node-waf
This link will help you to understand the what is going on.
Now install express with npm and the same synlinking we need to do for each package that we create.
ln -s /usr/local/bin/express /usr/bin/express
ln -s /usr/local/bin/node-supervisor /usr/bin/node-supervisor
ln -s /usr/local/bin/supervisor /usr/bin/supervisor
ln -s /usr/local/bin/n /usr/bin/n
It will be good to go through this link before we start installing new packages. This will help you understand how to install a npm package.
n stable
it will be good if we install any daemon based package to manage our nodejs app. So it will take care of handling the nodejs instance running.
npm install forever
npm install forever-monitor
ln -s /usr/local/bin/forever /usr/bin/forever
Now you can start nodejs daemon in forever as -
forever start /tmp/node/UpgradeChecker/app/bin/www
If you want to make this as a custom service then check this link. If you do then you can start your app like,
service nodeapp start
No comments:
Post a Comment