You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -33,7 +33,7 @@ You can verify afterwards if the installation was successful by checking the ver
*`node -v`, returns value **v4.6.0**
*`npm -v`, returns value **2.15.9**
If by any chance, your are in the root environment and the previous command returns "**-bash: node: command not found**", you can fix this by creating the following symbolic links :
If by any chance, you are in the root environment and the previous command returns "**-bash: node: command not found**", you can fix this by creating the following symbolic links :
```
sudo ln -s /usr/local/bin/node /usr/bin/node
nrollr
renamed
this gist Oct 8, 2016.
1 changed file
with
0 additions
and
0 deletions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following will guide you through the process of installing [Node.js](https://nodejs.org/en/) on an AWS EC2 instance running Amazon Linux AMI 2016.09 - [Release Notes](https://aws.amazon.com/amazon-linux-ami/2016.09-release-notes/)
For this process I'll be using a t2.micro EC2 instance running
Amazon Linux AMI (**ami-d41d58a7**).
Once the EC2 instance is up-and-running, connect to your server via ssh
* Make sure our server has the [latest packages](https://aws.amazon.com/amazon-linux-ami/2016.09-packages/) :
For the next steps, use `/tmp` as the working directory
* Download the Node.js source code, select the recommended LTS version via the [Node.js download page](https://nodejs.org/en/download/) and copy the URL of the "Source Code" -package : `curl -O https://nodejs.org/dist/v4.6.0/node-v4.6.0.tar.gz`
* Configure, make and install,... this may take a while, especially the compiling part.
```
$ cd node-v4.6.0
$ ./configure
$ make
$ sudo make install
```
You can verify afterwards if the installation was successful by checking the versions of **node** and **npm** :
*`node -v`, returns value **v4.6.0**
*`npm -v`, returns value **2.15.9**
If by any chance, your are in the root environment and the previous command returns "**-bash: node: command not found**", you can fix this by creating the following symbolic links :
```
sudo ln -s /usr/local/bin/node /usr/bin/node
sudo ln -s /usr/local/lib/node /usr/lib/node
sudo ln -s /usr/local/bin/npm /usr/bin/npm
```
### Testing Node.js
The best method to test Node.js is actually run an application. This this prurpose we'll configure and runs a simple webserver. Again, let's use `/tmp` as our working directory..
* Create a subdirectory : `mkdir www`
* Enter the directory : `cd www`
* Create a file called **server.js** and edit the contents of the file : `nano server.js`
* Paste the following code and save :
```
var http = require('http');
var server = http.createServer(function (request, response) {