Last active
June 9, 2016 19:12
-
-
Save alvincrespo/45d081fd6afc9d9e416182a87ffd9947 to your computer and use it in GitHub Desktop.
Installing Node/NPM on Ubuntu 14.04
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
#!/bin/bash | |
# Purpose | |
# This script will install Node.js Version 6.x onto an Ubuntu 14.04 server | |
# Installation / Usage | |
# Create a scripts directory on your server (e.g. /root/scripts) | |
# Set the scripts directory into the PATH | |
# Copy the raw version of this file into the scripts directory | |
# Set the permissions of the file: chmod u+x install-node.sh | |
# Execute the file | |
# Reference | |
# - https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-an-ubuntu-14-04-server | |
# - https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-14-04 | |
# https://gist.github.com/alvincrespo/ea8a01635caa30b4076593b4a9a26a90 | |
SCRIPT_URL=https://git.io/vo3kn | |
echo "$(tput setaf 3)Updating...$(tput sgr0)" | |
sudo apt-get -qq update | |
echo "$(tput setaf 3)Installing Git...$(tput sgr0)" | |
sudo apt-get -qq install git | |
echo "$(tput setaf 3)Installing Node and NPM$(tput sgr0)" | |
curl -sL SCRIPT_URL | sudo -E bash - | |
sudo apt-get -qq install -y nodejs | |
npm config set loglevel silent | |
echo "$(tput setaf 3)Installing pm2$(tput sgr0)" | |
npm install -g pm2 | |
echo "$(tput setaf 3)Installing NGINX$(tput sgr0)" | |
sudo apt-get -qq install nginx | |
echo "$(tput setaf 3)Verifying Installation$(tput sgr0)" | |
NODE_VERSION="$(node -v)" | |
NPM_VERSION="$(npm -v)" | |
PM2_VERSION="$(pm2 -v)" | |
echo "$(tput setaf 2)Node: ${NODE_VERSION}" | |
echo "NPM: ${NPM_VERSION}" | |
echo "PM2: ${PM2_VERSION}" | |
NGINX_VERSION="$(nginx -v)" | |
echo "$(tput sgr0)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment