Last active
August 29, 2015 14:07
-
-
Save fotisp/f627bdd7f7fb2b0f0f53 to your computer and use it in GitHub Desktop.
This gist will run the necessary processes to install node,npm,imagemagick et.al on a 14.04 LTS installation. It has not be tested for multiple runs, and only on a fresh install, any dependency breaks are on you.
This file contains 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 | |
if [ "$EUID" -ne 0 ] | |
then echo "Please run as root" | |
exit | |
fi | |
print_status() { | |
echo | |
echo "## $1" | |
echo | |
} | |
bail() { | |
echo 'Error executing command, exiting' | |
exit 1 | |
} | |
exec_cmd_nobail() { | |
echo "+ $1" | |
bash -c "$1" | |
} | |
exec_cmd() { | |
exec_cmd_nobail "$1" || bail | |
} | |
print_status "Preparing to install" | |
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 | |
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | tee /etc/apt/sources.list.d/mongodb.list | |
#This command runs apt-get update | |
curl -sL https://deb.nodesource.com/setup | bash - | |
apt-get install -y imagemagick nodejs nginx git mongodb-org build-essential ghostscript | |
exec_cmd "npm --version" | |
exec_cmd "nodejs --version" | |
exec_cmd "mongo -version" | |
print_status "Installing Stagecoach" | |
exec_cmd "mkdir -p /opt/" | |
exec_cmd "rm -rf /opt/stagecoach" | |
exec_cmd "git clone https://github.com/punkave/stagecoach.git /opt/stagecoach" | |
exec_cmd | |
exec_cmd "echo \"# Currently must be /opt/stagecoach\" > /opt/stagecoach/settings" | |
exec_cmd "echo \"DIR=/opt/stagecoach\" >> /opt/stagecoach/settings" | |
exec_cmd "echo \"# User to launch individual webapps as.\" >> /opt/stagecoach/settings" | |
exec_cmd "echo \"# Since they do not listen on port 80 this need not be root\" >> /opt/stagecoach/settings" | |
exec_cmd "echo \"USER=apps\" >> /opt/stagecoach/settings" | |
exec_cmd "adduser --home /opt/stagecoach/apps --disabled-password --gecos \"Application User\" apps" | |
exec_cmd "chown -R apps:apps /opt/stagecoach/apps" | |
exec_cmd "mkdir -p /opt/stagecoach/apps/.ssh/" | |
exec_cmd "npm install -g forever" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
curl -sL https://gist.github.com/fotisp/f627bdd7f7fb2b0f0f53/raw/base-node-install-ubuntu-14-04 | sudo bash -