Created
November 26, 2012 12:53
-
-
Save zh/4148065 to your computer and use it in GitHub Desktop.
Install Ruby via rbenv (and ruby-build) on Ubuntu Linux
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: install ruby + rbenv on Ubuntu Linux | |
| VERSION="1.9.3-p327" | |
| echo "[*] --> Updates packages lists." 1>&2 | |
| sudo apt-get update -y | |
| echo "[*] --> Installs curl and GIT packages." 1>&2 | |
| sudo apt-get git-core curl -y | |
| echo "[*] --> Installs ImageMagick for image processing." 1>&2 | |
| sudo apt-get install imagemagick --fix-missing -y | |
| echo "[*] --> Installs Rails required packages." 1>&2 | |
| sudo apt-get install build-essential bison openssl curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoco | |
| nf libc6-dev nodejs -y | |
| echo "[*] --> Installs rbenv." 1>&2 | |
| curl https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash | |
| echo "[*] --> Fix ~/.bash_profile." 1>&2 | |
| cat >> ${HOME}/.bash_profile <<DELIM | |
| # ---[ RBENV start ]--- | |
| export RUBY_HEAP_MIN_SLOTS=1000000 | |
| export RUBY_HEAP_SLOTS_INCREMENT=1000000 | |
| export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 | |
| export RUBY_GC_MALLOC_LIMIT=100000000 | |
| export RUBY_HEAP_FREE_MIN=500000 | |
| export RBENV_ROOT="\${HOME}/.rbenv" | |
| if [ -d "\${RBENV_ROOT}" ]; then | |
| export PATH="\${RBENV_ROOT}/bin:\${PATH}" | |
| eval "\$(rbenv init -)" | |
| fi | |
| # ---[ RBENV end ]--- | |
| DELIM | |
| source ${HOME}/.bash_profile | |
| echo "[*] --> Installs required Ubuntu packages." 1>&2 | |
| rbenv bootstrap-ubuntu-12-04 | |
| rbenv patch-ruby-build | |
| echo "[*] --> Installs ruby-${VERSION}." 1>&2 | |
| curl https://raw.github.com/gist/1688857/2-${VERSION}-patched.sh > /tmp/${VERSION} | |
| CFLAGS="-march=native -O3 -pipe -fomit-frame-pointer" rbenv install /tmp/${VERSION} | |
| rbenv global ${VERSION} | |
| rbenv rehash | |
| echo "[*] --> Installs rake and bundler gems." 1>&2 | |
| rbenv bootstrap | |
| rbenv rehash | |
| gem install rb-readline foreman thin rails --no-rdoc --no-ri | |
| rbenv rehash | |
| echo "[*] --> Cleanup." 1>&2 | |
| rm -rf /tmp/${VERSION} /tmp/ruby-* | |
| echo "[*] --> Installed:" 1>&2 | |
| echo -n " - SQLine: " 1>&2 | |
| (sqlite3 --version | cut -d " " -f 1) 1>&2 | |
| echo -n " - Ruby: " 1>&2 | |
| (ruby -v | cut -d " " -f 2) 1>&2 | |
| echo -n " - Rails: " 1>&2 | |
| rails -v 1>&2 | |
| echo -e "[*] ---[ DONE ]---\n" | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment