Install Node.js on CentOS/RHEL 6/7
This tutorial will help you to install node.js on Ubuntu and Debain systems with an example application.
Step #1 Install Optional Packages
Run the following command to install all optional packages If required:
# apt-get install -y build-essential
Now install screen package in your system using following commands.
# yum install screen
Step #2 Add Node.js PPA
Run the following command to add Node.js repository in Ubuntu and Debain system.
# curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
Step #3 Install Node.js
After adding Node.js repository, run the below command to install node.js
# sudo apt-get install -y nodejs
Step #4 Check Node.js Version
Run following command to check the node.js version.
# node --version
Step #5 Configure Example Application using Express
First we required to install npm modules using following commands.
# npm -g install express supervisor express-generator
This time is to create application using express and npm using below set of commands.
# express technical
# cd technical
# npm install
The above commands will create a directory myapp and npm will install all the required modules to run your application from its software repository.
Now edit views/index.jade and add following content to show on default page.
# vim views/index.jade
p Welcome to Technical World (Ubuntu)
Finally start your application using supervisor.
# supervisor ./bin/www
This application by default start on port 3000. Access your application by connecting your server on port 3000 in your browser.