To run server.js, the socket.io file

  1. Install nodejs globally.
  2. install npm globally
  3. go to your project folder and install npm modules
  4. npm install connect
  5. npm install socket.io
  6. Make sure the port your're using is open in the iptables, if not follow these steps
  7. sudo nano /etc/iptables.firewall.rules
    Add a new port as:
    -A INPUT -p tcp --dport 3000 -j ACCEPT
    i.e. if you're running socket.io on port 3000
  8. Activate the firewall rules by entering the following command:
    	sudo iptables-restore < /etc/iptables.firewall.rules
    
  9. Now run the script with preferably forever