Skip to content

Instantly share code, notes, and snippets.

@iamcaleberic
Last active April 18, 2017 09:27
Show Gist options
  • Save iamcaleberic/12852eb1ec5da2bdd56b9a27036a8ea1 to your computer and use it in GitHub Desktop.
Save iamcaleberic/12852eb1ec5da2bdd56b9a27036a8ea1 to your computer and use it in GitHub Desktop.
Setting up a Node.js Environment Production

Method 1

  • Download node archive from https://nodejs.org
    • wget https://nodejs.org/dist/v6.10.1/node-v6.10.1-linux-x64.tar.xz
  • Extract tarball
    • mkdir node
    • tar xvf node-v*.tar.?z --strip-components=1 -C ./node
  • Configure prefix & symlinks for npm
    • mkdir node/etc
    • echo 'prefix=/usr/local' > node/etc/npmrc
  • Moving binaries to installation loaction
    • sudo mv node /opt/
  • Modifying permissions of directories and sub-directories
    • sudo chown -R root: /opt/node
  • Symbolic links to binaries for default path
    • sudo ln -s /opt/node/bin/node /usr/local/bin/node
    • sudo ln -s /opt/node/bin/npm /usr/local/bin/npm
  • Test Drive
    • node -v
      • v6.10.1

Method 2

  • curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
  • sudo apt-get install -y nodejs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment