Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
<!DOCTYPE HTML>
<html lang="en-US" >
    
    <head>
        
        <meta charset="UTF-8">
        <title>EC2 | Full Stack JavaScript Engineering</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 1.1.0">
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    
    
    
    <link rel="next" href="../backbone/README.html" />
    
    
    <link rel="prev" href="../auth_auth/angular_jwt_basic.html" />
    

        
    </head>
    <body>
        
        
<link rel="stylesheet" href="../gitbook/style.css">


        
    <div class="book" data-level="16" data-basepath=".." data-revision="1412284764662">
    

<div class="book-summary">
    <div class="book-search">
        <input type="text" placeholder="Type to search" class="form-control" />
    </div>
    <ul class="summary">
        
    	
    	
    	

        

        
    
        
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                        <i class="fa fa-check"></i>
                        
                         Introduction
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="1" data-path="pre-work/README.html">
            
                
                    <a href="../pre-work/README.html">
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                         Prework
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="2" data-path="communication/connect_to_irc.html">
            
                
                    <a href="../communication/connect_to_irc.html">
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                         Connect to IRC
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="3" data-path="setup/README.html">
            
                
                    <a href="../setup/README.html">
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                         Setup
                    </a>
                
            
            
            <ul class="articles">
                
    
        
        <li class="chapter " data-level="3.1" data-path="setup/ToolsOverview.html">
            
                
                    <a href="../setup/ToolsOverview.html">
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                         JavaScript Tools Overview
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="3.2" data-path="setup/computer_setup.html">
            
                
                    <a href="../setup/computer_setup.html">
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                         Computer Setup
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="3.3" data-path="setup/initial_toolchain_practice.html">
            
                
                    <a href="../setup/initial_toolchain_practice.html">
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                         Make sure grunt works
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="3.4" data-path="setup/install_node_from_source.html">
            
                
                    <a href="../setup/install_node_from_source.html">
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                         For Linux: Compile Node from Source
                    </a>
                
            
            
        </li>
    

            </ul>
            
        </li>
    
        
        <li class="chapter " data-level="4" data-path="hello-world-node/README.html">
            
                
                    <a href="../hello-world-node/README.html">
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                         Hello World Node
                    </a>
                
            
            
            <ul class="articles">
                
    
        
        <li class="chapter " data-level="4.1" data-path="hello-world-node/async_demo.html">
            
                
                    <a href="../hello-world-node/async_demo.html">
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                         Async Demo
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="4.2" data-path="hello-world-node/hello_express.html">
            
                
                    <a href="../hello-world-node/hello_express.html">
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                         Hello Express
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="4.3" data-path="hello-world-node/grunt.html">
            
                
                    <a href="../hello-world-node/grunt.html">
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                         Grunt
                    </a>
                
            
            
        </li>
    

            </ul>
            
        </li>
    
        
        <li class="chapter " data-level="5" data-path="underscore-functional/README.html">
            
                
                    <a href="../underscore-functional/README.html">
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                         Underscore and Functional Programming
                    </a>
                
            
            
            <ul class="articles">
                
    
        
        <li class="chapter " data-level="5.1" data-path="underscore-functional/underscore.html">
            
                
                    <a href="../underscore-functional/underscore.html">
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                         Underscore
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="5.2" data-path="underscore-functional/functional.html">
            
                
                    <a href="../underscore-functional/functional.html">
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                         Functional Programming
                    </a>
                
            
            
        </li>
    

            </ul>
            
        </li>
    
        
        <li class="chapter " data-level="6" data-path="yeoman-assets-rwd/README.html">
            
                
                    <a href="../yeoman-assets-rwd/README.html">
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                         Generators, Asset Pipeline, and RWD
                    </a>
                
            
            
            <ul class="articles">
                
    
        
        <li class="chapter " data-level="6.1" data-path="yeoman-assets-rwd/sass.html">
            
                
                    <a href="../yeoman-assets-rwd/sass.html">
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                         Sass
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="6.2" data-path="yeoman-assets-rwd/responsive.html">
            
                
                    <a href="../yeoman-assets-rwd/responsive.html">
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                         Responsive Web Design
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="6.3" data-path="yeoman-assets-rwd/Personal_Blog_Site_Tutorial_with_Yeoman_and_Zurb.html">
            
                
                    <a href="../yeoman-assets-rwd/Personal_Blog_Site_Tutorial_with_Yeoman_and_Zurb.html">
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                         Personal Blog Site Tutorial with Yeoman and Zurb
                    </a>
                
            
            
        </li>
    

            </ul>
            
        </li>
    
        
        <li class="chapter " data-level="7" data-path="heroku/Heroku.html">
            
                
                    <a href="../heroku/Heroku.html">
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                         Heroku
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="8" data-path="casper/acceptance_testing_with_casperjs.html">
            
                
                    <a href="../casper/acceptance_testing_with_casperjs.html">
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                         Acceptance Testing with CasperJS
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="9" data-path="day6/README.html">
            
                
                    <a href="../day6/README.html">
                        <i class="fa fa-check"></i>
                        
                            <b>9.</b>
                        
                         Day Six
                    </a>
                
            
            
            <ul class="articles">
                
    
        
        <li class="chapter " data-level="9.1" data-path="day6/day6_readings.html">
            
                
                    <a href="../day6/day6_readings.html">
                        <i class="fa fa-check"></i>
                        
                            <b>9.1.</b>
                        
                         Readings
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="9.2" data-path="day6/Browserify.html">
            
                
                    <a href="../day6/Browserify.html">
                        <i class="fa fa-check"></i>
                        
                            <b>9.2.</b>
                        
                         Browserify
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="9.3" data-path="day6/Browserify_lab.html">
            
                
                    <a href="../day6/Browserify_lab.html">
                        <i class="fa fa-check"></i>
                        
                            <b>9.3.</b>
                        
                         Browserify lab
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="9.4" data-path="day6/requirejs.html">
            
                
                    <a href="../day6/requirejs.html">
                        <i class="fa fa-check"></i>
                        
                            <b>9.4.</b>
                        
                         Require.js
                    </a>
                
            
            
        </li>
    

            </ul>
            
        </li>
    
        
        <li class="chapter " data-level="10" data-path="day7/README.html">
            
                
                    <a href="../day7/README.html">
                        <i class="fa fa-check"></i>
                        
                            <b>10.</b>
                        
                         Day Seven
                    </a>
                
            
            
            <ul class="articles">
                
    
        
        <li class="chapter " data-level="10.1" data-path="day7/unit_testing.html">
            
                
                    <a href="../day7/unit_testing.html">
                        <i class="fa fa-check"></i>
                        
                            <b>10.1.</b>
                        
                         Unit Testing
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="10.2" data-path="day7/REST.html">
            
                
                    <a href="../day7/REST.html">
                        <i class="fa fa-check"></i>
                        
                            <b>10.2.</b>
                        
                         REST
                    </a>
                
            
            
        </li>
    

            </ul>
            
        </li>
    
        
        <li class="chapter " data-level="11" data-path="day8/README.html">
            
                
                    <a href="../day8/README.html">
                        <i class="fa fa-check"></i>
                        
                            <b>11.</b>
                        
                         Day Eight
                    </a>
                
            
            
            <ul class="articles">
                
    
        
        <li class="chapter " data-level="11.1" data-path="day8/superagent_testing.html">
            
                
                    <a href="../day8/superagent_testing.html">
                        <i class="fa fa-check"></i>
                        
                            <b>11.1.</b>
                        
                         Test With Super Agent
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="11.2" data-path="day8/mongo_mongoose_and_the_rest.html">
            
                
                    <a href="../day8/mongo_mongoose_and_the_rest.html">
                        <i class="fa fa-check"></i>
                        
                            <b>11.2.</b>
                        
                         Mongo, Mongoose and the REST
                    </a>
                
            
            
        </li>
    

            </ul>
            
        </li>
    
        
        <li class="chapter " data-level="12" data-path="day9/README.html">
            
                
                    <a href="../day9/README.html">
                        <i class="fa fa-check"></i>
                        
                            <b>12.</b>
                        
                         Day Nine
                    </a>
                
            
            
            <ul class="articles">
                
    
        
        <li class="chapter " data-level="12.1" data-path="day9/ajax.html">
            
                
                    <a href="../day9/ajax.html">
                        <i class="fa fa-check"></i>
                        
                            <b>12.1.</b>
                        
                         AJAX
                    </a>
                
            
            
        </li>
    

            </ul>
            
        </li>
    
        
        <li class="chapter " data-level="13" data-path="day10/README.html">
            
                
                    <a href="../day10/README.html">
                        <i class="fa fa-check"></i>
                        
                            <b>13.</b>
                        
                         Day Ten
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="14" data-path="ember/README.html">
            
                
                    <a href="../ember/README.html">
                        <i class="fa fa-check"></i>
                        
                            <b>14.</b>
                        
                         Ember
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="15" data-path="auth_auth/README.html">
            
                
                    <a href="../auth_auth/README.html">
                        <i class="fa fa-check"></i>
                        
                            <b>15.</b>
                        
                         Auth
                    </a>
                
            
            
            <ul class="articles">
                
    
        
        <li class="chapter " data-level="15.1" data-path="auth_auth/basic_authentication.html">
            
                
                    <a href="../auth_auth/basic_authentication.html">
                        <i class="fa fa-check"></i>
                        
                            <b>15.1.</b>
                        
                         Server Auth
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="15.2" data-path="auth_auth/angular_jwt_basic.html">
            
                
                    <a href="../auth_auth/angular_jwt_basic.html">
                        <i class="fa fa-check"></i>
                        
                            <b>15.2.</b>
                        
                         Angular Client Auth
                    </a>
                
            
            
        </li>
    

            </ul>
            
        </li>
    
        
        <li class="chapter active" data-level="16" data-path="ec2/README.html">
            
                
                    <a href="../ec2/README.html">
                        <i class="fa fa-check"></i>
                        
                            <b>16.</b>
                        
                         EC2
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="17" data-path="backbone/README.html">
            
                
                    <a href="../backbone/README.html">
                        <i class="fa fa-check"></i>
                        
                            <b>17.</b>
                        
                         Backbone
                    </a>
                
            
            
            <ul class="articles">
                
    
        
        <li class="chapter " data-level="17.1" data-path="backbone/overview.html">
            
                
                    <a href="../backbone/overview.html">
                        <i class="fa fa-check"></i>
                        
                            <b>17.1.</b>
                        
                         Backbone Overview
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="17.2" data-path="backbone/models.html">
            
                
                    <a href="../backbone/models.html">
                        <i class="fa fa-check"></i>
                        
                            <b>17.2.</b>
                        
                         Backbone Models
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="17.3" data-path="backbone/views.html">
            
                
                    <a href="../backbone/views.html">
                        <i class="fa fa-check"></i>
                        
                            <b>17.3.</b>
                        
                         Backbone Views
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="17.4" data-path="backbone/collections.html">
            
                
                    <a href="../backbone/collections.html">
                        <i class="fa fa-check"></i>
                        
                            <b>17.4.</b>
                        
                         Backbone Collections
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="17.5" data-path="backbone/routers.html">
            
                
                    <a href="../backbone/routers.html">
                        <i class="fa fa-check"></i>
                        
                            <b>17.5.</b>
                        
                         Backbone Routes
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="17.6" data-path="backbone/backbone_crud.html">
            
                
                    <a href="../backbone/backbone_crud.html">
                        <i class="fa fa-check"></i>
                        
                            <b>17.6.</b>
                        
                         Backbone CRUD
                    </a>
                
            
            
        </li>
    

            </ul>
            
        </li>
    
        
        <li class="chapter " data-level="18" data-path="angular/angular_part_1.html">
            
                
                    <a href="../angular/angular_part_1.html">
                        <i class="fa fa-check"></i>
                        
                            <b>18.</b>
                        
                         Angular
                    </a>
                
            
            
            <ul class="articles">
                
    
        
        <li class="chapter " data-level="18.1" data-path="angular/angular_part_2.html">
            
                
                    <a href="../angular/angular_part_2.html">
                        <i class="fa fa-check"></i>
                        
                            <b>18.1.</b>
                        
                         Angular Part 2
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="18.2" data-path="Angular/angular_part_3.html">
            
                
                    <a href="../Angular/angular_part_3.html">
                        <i class="fa fa-check"></i>
                        
                            <b>18.2.</b>
                        
                         Angular Part 3
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="18.3" data-path="auth_auth/angular_jwt_basic.html">
            
                
                    <a href="../auth_auth/angular_jwt_basic.html">
                        <i class="fa fa-check"></i>
                        
                            <b>18.3.</b>
                        
                         Angular JWT
                    </a>
                
            
            
        </li>
    

            </ul>
            
        </li>
    


        
        <li class="divider"></li>
        <li>
            <a href="http://www.gitbook.io/" target="blank" class="gitbook-link">Published using GitBook</a>
        </li>
        
    </ul>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header">
    <!-- Actions Left -->
    <a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
    <a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
    
    <div id="font-settings-wrapper" class="dropdown pull-left">
        <a href="#" class="btn toggle-dropdown" aria-label="Toggle font settings"><i class="fa fa-font"></i>
        </a>
        <div class="dropdown-menu font-settings">
    <div class="dropdown-caret">
        <span class="caret-outer"></span>
        <span class="caret-inner"></span>
    </div>

    <div class="buttons">
        <button type="button" id="reduce-font-size" class="button size-2">A</button>
        <button type="button" id="enlarge-font-size" class="button size-2">A</button>
    </div>

    <div class="buttons font-family-list">
        <button type="button" data-font="0" class="button">Serif</button>
        <button type="button" data-font="1" class="button">Sans</button>
    </div>

    <div class="buttons color-theme-list">
        <button type="button" id="color-theme-preview-0" class="button size-3" data-theme="0">White</button>
        <button type="button" id="color-theme-preview-1" class="button size-3" data-theme="1">Sepia</button>
        <button type="button" id="color-theme-preview-2" class="button size-3" data-theme="2">Night</button>
    </div>
</div>

    </div>

    <!-- Actions Right -->
    
    <div class="dropdown pull-right">
        <a href="#" class="btn toggle-dropdown" aria-label="Toggle share dropdown"><i class="fa fa-share-alt"></i>
        </a>
        <div class="dropdown-menu font-settings dropdown-left">
            <div class="dropdown-caret">
                <span class="caret-outer"></span>
                <span class="caret-inner"></span>
            </div>
            <div class="buttons">
                <button type="button" data-sharing="twitter" class="button">Twitter</button>
                <button type="button" data-sharing="google-plus" class="button">Google</button>
                <button type="button" data-sharing="facebook" class="button">Facebook</button>
                <button type="button" data-sharing="weibo" class="button">Weibo</button>
                <button type="button" data-sharing="instapaper" class="button">Instapaper</button>
            </div>
        </div>
    </div>
    

    
    <a href="#" target="_blank" class="btn pull-right google-plus-sharing-link sharing-link" data-sharing="google-plus" aria-label="Share on Google Plus"><i class="fa fa-google-plus"></i></a>
    
    
    <a href="#" target="_blank" class="btn pull-right facebook-sharing-link sharing-link" data-sharing="facebook" aria-label="Share on Facebook"><i class="fa fa-facebook"></i></a>
    
    
    <a href="#" target="_blank" class="btn pull-right twitter-sharing-link sharing-link" data-sharing="twitter" aria-label="Share on Twitter"><i class="fa fa-twitter"></i></a>
    
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >Full Stack JavaScript Engineering</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-gitbook_30">
                    
                        <h1 id="how-to-host-a-nodejs-app-on-an-ec2-ubuntu-server">How to host a NodeJS app on an EC2 Ubuntu Server</h1>
<p>I will take you through the process of setting up your first server on an Amazon
Elastic Compute Cloud (EC2) Ubuntu Server.</p>
<h2 id="sign-up-for-amazon-web-services-free-tier">Sign up for Amazon Web Services Free Tier</h2>
<ul>
<li>Tip: sign up with a new email if your account is older than a year</li>
</ul>
<h2 id="create-a-new-key-pair-or-upload-an-ssh-public-key">Create a New Key Pair or Upload an SSH Public Key</h2>
<ul>
<li>Visit <a href="https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#KeyPairs:" target="_blank">aws ssh key pairs</a></li>
<li>I have found it&#39;s easier to upload a public key that you&#39;ve created on your own
machine. Visit <a href="https://help.github.com/articles/generating-ssh-keys" target="_blank">Github Help</a>
if you need help creating your own public/private key pair.</li>
</ul>
<h2 id="find-and-launch-an-ami">Find and launch an AMI</h2>
<ul>
<li>Sign in to <a href="http://aws.amazon.com/console/" target="_blank">AWS Management Console</a></li>
<li>Select EC2</li>
<li>Click on the blue &quot;Launch Instance&quot; button</li>
<li>Choose an AMI: Choose Ubuntu 14.04 LTS</li>
<li>Choose an Instance Type: t2.micro (make sure it says free tier eligible)</li>
<li>Click &quot;Next: Configure Intsance Details&quot;</li>
<li>We can just use the defaults here: Click &quot;Next: Add Storage&quot;</li>
<li>We can just use the defaults again here: Click &quot;Next: Tag Instance&quot;</li>
<li>Add a tag, for example a key of &quot;Class&quot; and a Value of &quot;B20&quot;</li>
<li>Click &quot;Next: Configure Security Group&quot;</li>
<li>Create a new security group should be selected. It will default to ssh access
only. Add two more types of rules for access to ports 80 and 443 (HTTP and HTTPS)</li>
<li>Click &quot;Review and Launch&quot;</li>
</ul>
<h2 id="connect-to-your-ec2-machine-instance">Connect to your EC2 Machine Instance</h2>
<ul>
<li>Click on View Instances or visit your <a href="https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#Instances:" target="_blank">EC2 Dashboard</a></li>
<li>instance state will be &#39;initializing&#39; then &#39;running&#39; eventually</li>
<li>find &quot;Public IP&quot; column and note address</li>
<li>or find the &quot;Public DNS&quot; for the full hostname. This is useful as your IP address might change</li>
<li><code>ssh ubuntu@hostname</code></li>
<li>if you created a new key and it&#39;s not in your ssh keychain you may need to:</li>
</ul>
<p><code>ssh ubuntu@hostname -I ~/.ssh/path-to-keyfile</code></p>
<p> replace path-to-keyfile with the actual path of your key file</p>
<ul>
<li>make an A record on your domain in <a href="http://aws.amazon.com/route53/" target="_blank">Route 53</a>
   for convenience</li>
</ul>
<h2 id="install-prerequisites-and-common-packages">Install Prerequisites and Common Packages</h2>
<p>The <code>-y</code> option is helpful because apt won&#39;t for wait for you to press &#39;y&#39;, it
will just install the packages. Very helpful for when you&#39;re trying to script
this entire process.</p>
<pre><code>sudo apt-get update &amp;&amp; sudo apt-get install -y build-essential g++ tmux
</code></pre><h2 id="install-node-build-from-source">Install Node, Build from Source</h2>
<pre><code>curl -O http://nodejs.org/dist/v0.10.32/node-v0.10.32.tar.gz
tar -xvzf node-v0.10.32.tar.gz
cd node-v0.10.32
./configure --prefix=/opt/node
make
sudo mkdir -p /opt/node
sudo chown -R ubuntu.ubuntu /opt/node
make install
</code></pre><p>Add node to your path in <code>~/.bashrc</code>:</p>
<p><code>echo &quot;export PATH=/opt/node/bin:$PATH&quot; &gt;&gt; ~/.bashrc</code></p>
<p>Then reload <code>.bashrc</code></p>
<p><code>source ~/.bashrc</code></p>
<p>Double check to see that node is in your path:</p>
<p><code>which node</code> =&gt; should be <code>/opt/node/bin/node</code></p>
<p>Now, we need to add node to root&#39;s path too. To do this, we will need to use the
<code>visudo</code> command to edit the secure path.</p>
<p><code>sudo visudo</code></p>
<p>edit your <code>Defaults  secure_path=</code> line, around the thrird line, to look like:</p>
<p><code>Defaults        secure_path=&quot;/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/node/bin&quot;</code></p>
<p>The key here is to put the path to node at the end of the secure path.</p>
<p>Go ahead and save the file.</p>
<h2 id="install-the-latest-mongodb">Install the Latest MongoDB</h2>
<p>Follow the directions here:
<a href="http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/" target="_blank">http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/</a></p>
<p>To summarize:</p>
<pre><code>sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo &#39;deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen&#39; | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install mongodb-org
</code></pre><h2 id="install-the-latest-redis">Install the Latest Redis</h2>
<p>Luckily, Chris Lea keeps an up-to-date ubuntu ppa available.</p>
<pre><code>sudo add-apt-repository ppa:chris-lea/redis-server
sudo apt-get update
sudo apt-get install redis-server -y
</code></pre><h2 id="install-the-latest-git">Install the Latest Git</h2>
<pre><code>sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git -y
</code></pre><h3 id="test-mongodb-is-running">Test MongoDB is running</h3>
<pre><code>mongo
show dbs
</code></pre><ul>
<li>ctrl-d to exit</li>
</ul>
<h3 id="test-redis-is-running">Test Redis is running</h3>
<ul>
<li><code>redis-cli ping</code> --&gt; should see  <code>PONG</code></li>
</ul>
<h2 id="a-neat-trick-to-find-the-external-ip">A Neat Trick to Find the External IP</h2>
<p>You can always find the External IP address of your server in the EC2 Dashboard,
but I frequently use this shortcut from the command line:</p>
<p><code>curl icanhazip.com</code></p>
<h2 id="bower-all-the-things">Bower ALL THE THINGS</h2>
<p>I mean, install bower and any other global npm packages you use frequently.</p>
<p><code>npm -g install bower grunt-cli</code></p>
<h2 id="clone-your-app-and-install-npm-and-bower-packages">Clone Your App and Install NPM and Bower Packages</h2>
<p>I&#39;ll use one of our example apps.</p>
<p>Make sure you&#39;re in the ubuntu home directory: <code>/home/ubuntu</code></p>
<pre><code>cd
git clone https://github.com/codefellows/javascript-b15-notes.git notes
cd notes
npm install &amp;&amp; bower install
</code></pre><h2 id="launch-the-server-on-port-80">Launch the server on Port 80</h2>
<p>To test out launching your app, and bind on any port under 1000, you need to use <code>sudo</code> to
escalate to root privelege.</p>
<pre><code>sudo -i
PORT=80 node server.js
</code></pre><p>visit the site <a href="http://YOUR-IP-HERE" target="_blank">http://YOUR-IP-HERE</a></p>
<p>This will do in a pinch, but it&#39;s not a professional setup. What happens if your
server reboots? You want something to re-start the server automatically.</p>
<h2 id="install-the-forever-npm-package">Install the Forever NPM Package</h2>
<p><code>npm -g install forever</code>. Forever is a simple CLI tool for ensuring that a given script runs continuously.</p>
<p>Create <code>/etc/init/notes.conf</code>. This is an <a href="http://en.wikipedia.org/wiki/Upstart" target="_blank">Ubuntu Upstart</a> script.</p>
<p>You can always use <code>nano</code> if you are <a href="http://vim-adventures.com" target="_blank">afraid of Vim&hellip;</a></p>
<p><code>/etc/init/notes.conf</code>:</p>
<pre><code>start on startup
stop on shutdown

expect fork

script
  PATH=/opt/node/bin:$PATH
  export PORT=80
  exec forever start /home/ubuntu/notes/server.js
end script

pre-stop script
  PATH=/opt/node/bin:$PATH
  exec forever stop /home/ubuntu/notes/server.js
end script
</code></pre><p>Then <code>sudo start notes</code> to start the app</p>
<p>You can use use <code>sudo status notes</code> to see the status of the service.</p>
<h1 id="install-an-ssl-certificate">Install an SSL Certificate</h1>
<p>You can get a <a href="https://www.startssl.com" target="_blank">free SSL certificate</a>, or for development,
you can generate a self-signed certificate. Follow this <a href="https://devcenter.heroku.com/articles/ssl-certificate-self" target="_blank">Heroku Tutorial</a></p>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../auth_auth/angular_jwt_basic.html" class="navigation navigation-prev " aria-label="Previous page: Angular Client Auth"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../backbone/README.html" class="navigation navigation-next " aria-label="Next page: Backbone"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="https://cdn.mathjax.org/mathjax/2.4-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-mathjax/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"fontSettings":{"theme":null,"family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>