Installing NodeJS
This section assumes that you are using the Xubuntu development environment that was built in this document. If using other environment, you will have to adapt the commands/paths accordingly.
- Run the following commands:
sudo apt-get install curl -y
sudo curl -sL https://deb.nodesource.com/setup_4.x |
sudo -E bash –
sudo
apt-get
install -y nodejs
Note: for Enterprise Linux and Fedora Linux distributions (OEL, RH, etc.)
sudo su –
curl –silent –location https://rpm.nodesource.com/setup_4.x |
bash –
sudo yum -y install nodejs
- Confirm Node is installed by typing node –version
For more information refer to https://nodejs.org/en/download/package-manager/
Test your NodeJS envionrment using Nikolay Anastasov’s Web Chat
- Inside your Xubuntu environment open the browser and go to: http://tutorialzine.com/2014/03/nodejs-private-webchat/
- Download the Web Chat demo, by clicking on the blue “Download” button
Feel free to read the instructions on the page.
- Create a directory called “nodejs-private-webchat” – Then unzip the demo that you downloaded into this directory
-
Make sure you are inside the directory “nodejs-private-webchat“. Then, install the Web Chat dependencies using NPM:
npm install
This will install 4 dependencies indicated in package.json (ejs, express, gravatar and socket.io)
Make sure it completes successfully.
-
Then run the main app.js
node app.js
It will start the Web Chat Application running on port 8080
-
Then open 1 browser and go to: http://%5Byour _IP]:8080
This should open a page where you can create a new private room:
- Enter your Name and your email address.
Note: This Web Chat uses Gravatar in order to show your photo associated with your email. If you still don’t have a Gravatar account, create one! So that this Web Chat and plenty of other places your selected photo can be displayed, instead of an anonymous “grey avatar”.
In order to create a new Gravatar account go to: https://en.gravatar.com/ – If you Already have a WordPress account, you can use that one to log in. Otherwise you can create a new account. |
- You should see that a new Private chat has been created for you and someone you invite.
- Send the provided link to start chatting.
- Once another person joins your private chat, the two of you should be able to start chatting.
One thought on “Teaching how to use NodeJS in your local environment”