This is an old revision of the document!
Install Node.js on Ubuntu 14.04
Introduction
Node.js is part of the next generation web servers that is small; fast and super efficient.
Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
-
The reason we are interested in Node.js is because it supports Websocket. Websocket is a reasonably new technology that is supported by the latest versions of all the major browsers which allows you to display data in real-time.
-
We will make use of Socket.IO as a wrapper to Websocket which runs on Node.js to read the log file and debug output of FreeRADIUS in real-time.
-
So to summarise : Node.js→Websocket→Soket.IO→Client.
Install Node.js and dependencies
sudo apt-get update
sudo apt-get install python-software-properties python g++ make
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
Note that we are using an older version of socket.io (0.9.x) instead of the latest 1.x.
sudo npm -g install tail
sudo npm -g install socket.io@0.9.x
sudo npm -g install connect
sudo npm -g install mysql
sudo npm -g install forever
Add start-up script
Everything is now installed that we will need to enable us to serve the FreeRADIUS log file in real-time using Node.js, Websocket and Socet.IO.
We need to install a start-up file, start the Node.js server up and confirm that it works.
sudo cp /usr/share/nginx/html/cake2/rd_cake/Setup/Node.js/nodejs-socket-io /etc/init.d
sudo chmod 755 /etc/init.d/nodejs-socket-io
sudo update-rc.d nodejs-socket-io start 80 2 3 4 5 . stop 20 0 1 6 .
sudo cp /var/www/cake2/rd_cake/Setup/Node.js/nodejs-socket-io /etc/init.d
sudo chmod 755 /etc/init.d/nodejs-socket-io
sudo update-rc.d nodejs-socket-io defaults
Test the Node.js server
sudo /etc/init.d/nodejs-socket-io start
sudo cat /var/log/nodejs-socket-io.log
#Result in....
info: socket.io started
Up and running on port 8000
Things to remember about Websocket
Websocket is not supported in
IE version 9 and below.
Remember that this is running on port 8000 and some firewalls may block it.
You are welcome to alter the port on which Node.js serve by editing the /rd_cake/Setup/Node.js/Logfile.node.js file.
The start-up script calls Logfile.node.js during start-up. Depending on the web server you run; the absolute path of this script will change accordingly. Be sure to update this script as well if you change servers (Nginx VS Apache).
Although this Node.js server serves the FreeRADIUS log file; it will only be visible if the requester provides the token belonging to root. All other users will not be allowed to see this log file through the Node.js server.
Next steps
If you are simply looking for a RADIUS server; you are done.
If you are deploying CoovaChilli Captive Portals or Mikrotik Hotspots you must try the
Dynamic Login Pages (optional but recommended).
If you are looking at connecting Captive Portals through OpenVPN or PPTP to this server; do the following optional steps
If your server has two network cards and you want to install CoovaChilli on it as a captive portal; follow these instructions: