Wisdom of Jim
  • Blog
  • About Jim

A place to obtain the wisdom of Jim.

How to Install Node and Npm on an Ec2 Linux Server

4/8/2016

Comments

 
I really just wanted a server to play around with crontab and have it run node.js scripts. c9.io was not cutting it anymore so I signed up for the free tier on AWS. Their basic linux box is called "Ec2" in the dashboard (here's a guide for creating a new Ec2 linux instance on Amazon AWS). Once you create the server, you'll need to download the keyfile (and usually change the keyfile's permissions). Once you've ssh'ed into the box, you're ready to get node and npm!
When I'm setting up a box with node I also like to reference this excellent guide for installing npm and node.js on a linux instance. The last command for npm "sudo make install" was not working for me, but thankfully someone in the comments pointed out that you need to do this instead: sudo env PATH=$HOME/local/node/bin:$PATH make install.

If you need more details reference that awesome post above. If you're trying to just fly through it below is the important stuff- just the linux commands you'll want to run (tested on AWS Free tier Linux Red Hat):

Update the Linux OS

sudo yum update

Install git and Node.js

sudo yum install gcc-c++ make
sudo yum install openssl-devel
sudo yum install git
git clone git://github.com/joyent/node.git
cd node

Build Latest Version of Node.js from Github Project

Note: use git tag -l to list all versions. You usually want to choose the latest version.
git checkout v0.6.8
./configure
make
sudo make install

Add /usr/local/bin to the secure_path

sudo su
vi /etc/sudoers
Scroll down and find "Defaults   secure_path". Add this to the end of the value: ​:/usr/local/bin

Install NPM

git clone https://github.com/isaacs/npm.git
cd npm
sudo env PATH=$HOME/local/node/bin:$PATH make install

Huzzah!

That's all! Now you can install npm packages and run javascript node files as usual!
sudo npm install forever -g
sudo npm install express -g
Comments
comments powered by Disqus

    ​Author

    Picture
    The posts on this site are written and maintained by Jim Lynch. About Jim...

    Categories

    All
    Actionscript 3
    Angular
    AngularJS
    Automated Testing
    AWS Lambda
    Behavior Driven Development
    Blogging
    Business Building
    C#
    C / C++
    ClojureScript / Clojure
    Coding
    Community Service
    CS Philosophy
    Css / Scss
    Dev Ops
    Firebase
    Fitness
    Flash
    Front End
    Functional Programming
    Git
    Go Lang
    Haskell
    Illustrations
    Java
    Javascript
    Lean
    Life
    Logic Pro
    Music
    Node.js
    Planning
    Productivity
    Professionalism
    Python
    React
    Redux / Ngrx
    Refactoring
    Reusable Components
    Security
    Serverless
    Shell Scripting
    Swift
    Test Driven Development
    Things
    TypeScript
    Useful Sites
    Useful Tools
    Video
    Website Development
    WebStorm
    Writing

    Archives

    September 2019
    August 2019
    July 2019
    June 2019
    May 2019
    April 2019
    March 2019
    February 2019
    January 2019
    December 2018
    November 2018
    October 2018
    September 2018
    August 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018
    January 2018
    December 2017
    November 2017
    October 2017
    September 2017
    August 2017
    July 2017
    May 2017
    April 2017
    March 2017
    February 2017
    January 2017
    December 2016
    November 2016
    October 2016
    September 2016
    August 2016
    July 2016
    June 2016
    May 2016
    April 2016
    March 2016
    February 2016
    January 2016
    December 2015
    November 2015
    October 2015

    RSS Feed

  • Blog
  • About Jim

WoJ © 2015 - 2016