Skip to content

Instantly share code, notes, and snippets.

@artakvg
Last active October 4, 2015 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artakvg/2f8e89a31efaedc865a1 to your computer and use it in GitHub Desktop.
Save artakvg/2f8e89a31efaedc865a1 to your computer and use it in GitHub Desktop.
#!/bin/bash
# you can use "v4.0.0" for node 4.0.0 version
nodeVersion="v0.12.7"
## install libs
sudo apt-get -y update
sudo apt-get -y install build-essential
sudo apt-get -y install libssl-dev
sudo apt-get -y install libkrb5-dev
## installing git
sudo apt-get -y install git
## installing authbind for letting node to access ports below 1024 whithout sudo permision
sudo apt-get -y install authbind
sudo touch /etc/authbind/byport/80
sudo "$USER" chown /etc/authbind/byport/80
sudo chmod 755 /etc/authbind/byport/80
## nvm install
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.26.1/install.sh | bash
source ~/.profile
source ~/.bashrc
source ~/.nvm/nvm.sh
nvm install "$nodeVersion"
nvm alias default "$nodeVersion"
## installing several common used npm packages and pm2 node app manager
npm install -g node-gyp
npm install -g gulp
npm install -g bower
npm install -g shipit-cli
npm install -g flightplan
npm install -g pm2
## pm2 with authbind
sudo su -c "env PATH=$PATH:/home/$USER/.nvm/versions/node/$nodeVersion/bin pm2 startup ubuntu -u $USER"
authbind --deep pm2 update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment