Skip to content

Instantly share code, notes, and snippets.

@misteral
Last active October 5, 2015 07:48
Show Gist options
  • Save misteral/2773706 to your computer and use it in GitHub Desktop.
Save misteral/2773706 to your computer and use it in GitHub Desktop.
Rails vds environment
#!/bin/bash
# bash script for installing Rails environment on Ubuntu 12.04 Server
#
# Some sources has been changed to mirrors in China mainland.
#
# To use this script, do this in your shell:
#
# $ curl -L https://raw.github.com/gist/2773706/install_rails_vds_env.sh | bash
sudo echo ""; echo "Root Privilege Acquired"
echo ""
echo "======================================="
echo "========= Installing Aptitude ========="
echo "======================================="
echo ""
sudo apt-get -y install aptitude
echo ""
echo "======================================="
echo "=========== Installing RVM ============"
echo "======================================="
echo ""
curl -L get.rvm.io | bash -s stable
echo 'rvm_configure_env=(CFLAGS="-march=native -O3")' > ~/.rvmrc
source ~/.rvm/scripts/rvm
echo ""
echo "======================================="
echo "======= Installing Dependencies ======="
echo "======================================="
echo ""
#(more requirements)
sudo aptitude -y install build-essential openssl libreadline6 libreadline6-dev git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev automake libtool bison imagemagick libcurl4-gnutls-dev unzip libmysqlclient-dev libmagick++-dev libboost-filesystem-dev libmcrypt-dev
echo ""
echo "======================================="
echo "======== Installing Ruby 1.9.3 ========"
echo "======================================="
echo ""
rvm reinstall 1.9.3
rvm use 1.9.3 --default
rvm reinstall 1.9.3-perf --patch railsexpress
rvm use 1.9.3-perf --default
echo ""
echo "ruby version:"
ruby -v
echo ""
echo "gem version:"
gem -v
echo ""
echo ""
echo "======================================="
echo "======= no-doc no-rdoc gem ============"
echo "======================================="
touch ~/.gemrc
echo "gem: --no-rdoc --no-ri" > ~/.gemrc
echo ""
echo ""
echo ""
echo ""
echo "======================================="
echo "======= Install Node.js ==============="
echo "======================================="
sudo apt-get -y install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get -y install nodejs npm
echo ""
echo ""
echo ""
echo "======================================="
echo "======= Install MariaDB ==============="
echo "======================================="
echo ""
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
sudo touch /etc/apt/sources.list.d/mariadb.list
echo "deb http://mariadb.cu.be//repo/5.5/ubuntu precise main
deb-src http://mariadb.cu.be//repo/5.5/ubuntu precise main" > ~/mariadb.list
sudo cp ~/mariadb.list /etc/apt/sources.list.d/mariadb.list
sudo apt-get update
sudo apt-get -y install mariadb-server-5.5
sudo apt-get install libmariadbclient-dev
echo ""
echo ""
echo "======================================="
echo "======= Install NGINX ================="
echo "======================================="
#curl http://nginx.org/download/nginx-1.2.0.tar.gz
#nginx=stable # use nginx=development for latest development version
#sudo add-apt-repository ppa:nginx/$nginx
#sudo apt-get update
#sudo apt-get -y install nginx
echo ""
echo ""
echo "======================================="
echo "== Install Bundler+MYSQL2+nokogiry+curb"
echo "======================================="
echo ""
gem install bundler
rvm use @global
#gem install mysql2
#gem install nokogiri
#gem install curb
#gem install rmagick
#gem install god
#gem install unicorn
#gem install xmpp4r
echo ""
bundle -v
echo ""
echo ""
echo ""
echo "======================================="
echo " CONGRATULATIONS! "
echo " INSTALLATION COMPLETED! "
echo "======================================="
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment