|
#!/bin/bash |
|
|
|
################################## |
|
# This Ubuntu/Debian script installs Go, Ruby, Node, and PHP support packages for modern web application development. |
|
# This means LESS, SASS, Gems, NPM, Composer, Ionic, Yeoman, GOPATH, etc... |
|
# |
|
# - Go, GOPATH, GVM |
|
# - Ruby, Gems, RVM |
|
# - Node.js, NPM, NVM |
|
# - Composer [PHP] |
|
# |
|
# To install, run this command: |
|
# curl -sSL https://gist.githubusercontent.com/Xeoncross/3b8ed1d094707bc0dff8/raw/62c88a1855cccb9c365b57c7afab80894fd06a32/install.sh | bash |
|
# |
|
################################## |
|
|
|
|
|
# benchmark the time to setup the server |
|
_start_time=`date +%s` |
|
|
|
function print_warn { |
|
echo -n -e '\e[1;33m'; echo -n "$1"; echo -e '\e[0m' |
|
} |
|
|
|
function print_success { |
|
echo -n -e '\e[1;32m'; echo -n "$1"; echo -e '\e[0m' |
|
} |
|
|
|
function print_error { |
|
echo -n -e '\e[1;31m'; echo -n "$1"; echo -e '\e[0m' |
|
} |
|
|
|
function exit_error { |
|
print_error "$1" && exit 1 |
|
} |
|
|
|
if [ $(id -u) = 0 ]; then |
|
print_warn "WARNING: running as root" |
|
echo "Stop if running in vagrant (CTRL + C)" |
|
sleep 5 |
|
wait |
|
else |
|
echo "Running as: " $(whoami) |
|
sleep 3 |
|
wait |
|
fi |
|
|
|
if [[ ! -e /etc/debian_version ]]; then |
|
exit_error "You must be running debian or ubuntu to use this" |
|
fi |
|
|
|
|
|
|
|
######################################## |
|
|
|
# Update our fresh system before we get started |
|
sudo apt-key update |
|
sudo apt-get -qq update |
|
|
|
sudo apt-get -qq install git curl wget mercurial bzr htop |
|
|
|
# Install PHP |
|
sudo apt-get -qq install git curl wget php5-cli |
|
|
|
# PHP |
|
if [[ ! -e /usr/local/bin/composer ]]; then |
|
curl -sS https://getcomposer.org/installer | php |
|
wait |
|
sudo mv composer.phar /usr/local/bin/composer |
|
print_success "Composer installed to /usr/local/bin/composer" |
|
fi |
|
|
|
# |
|
# Go |
|
# |
|
sudo apt-get -qq install bison gcc golang-go golang-src |
|
|
|
# https://github.com/moovweb/gvm |
|
if [[ $? == 0 ]]; then |
|
if [[ ! -e ~/.gvm/scripts/gvm ]]; then |
|
print_success "Installing GVM" |
|
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) |
|
fi |
|
fi |
|
|
|
# This sets the gopath relative to your account |
|
if [[ ! -d ~/Go/ ]]; then |
|
echo "export GOPATH=~/Go" >> ~/.profile |
|
mkdir -p ~/Go/{bin/,pkg/,src/} |
|
print_success "Setup GOPATH=~/Go" |
|
fi |
|
|
|
# |
|
# Ruby with Gems |
|
# |
|
if [[ ! -e ~/.rvm ]]; then |
|
print_success "Installing RVM" |
|
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 |
|
curl -sSL https://get.rvm.io | bash -s stable --ruby |
|
fi |
|
|
|
# |
|
# Node.js and NPM |
|
# |
|
|
|
# https://github.com/creationix/nvm |
|
if [[ ! -e ~/.nvm ]]; then |
|
print_success "Installing NVM" |
|
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash |
|
#wait |
|
sleep 4 |
|
|
|
# s͢h̶èl̷l ͢rel͡oa҉d̕ hąck |
|
exec bash |
|
|
|
source ~/.{profile,bashrc} |
|
nvm install 0.11 |
|
nvm use 0.11 |
|
nvm alias default 0.11 |
|
npm install --global yo bower grunt-cli |
|
|
|
# exit s҉hell |
|
exit |
|
fi |
|
|
|
######################################## |
|
|
|
print_success "Setup Complete" |
|
|
|
# caculate time |
|
_end_time=`date +%s` |
|
_processing_time=$((_end_time-_start_time)) |
|
[[ -z $2 ]] && echo "$_processing_time seconds" |
|
|
|
echo "" |
|
print_error "### YOU ARE NOT DONE ###" |
|
echo "" |
|
|
|
print_warn "Please refresh your console session by running:" |
|
print_success " source ~/.{profile,bashrc}" |
|
echo "" |
|
|
|
print_warn "Then you can begin by picking the version of node you want to use:" |
|
print_success " nvm install 0.10" |
|
print_warn "and installing npm packages:" |
|
print_success " npm install --global yo bower grunt-cli jshint less gulp coffee-script cordova ionic" |
|
echo "" |
|
|
|
print_warn "Ruby is also setup, so you can also install gem packages:" |
|
print_success " gem install sass compass" |
|
|
|
exit 0 |
ubuntu 16.04 setup https://gist.github.com/slider23/ecda99d7fe3b51e5b34d21f9312bb1df