Skip to content

Instantly share code, notes, and snippets.

@Tyralion
Forked from milmih/rbenv-install.sh
Last active August 29, 2015 14:19
Show Gist options
  • Save Tyralion/1be4e286b19da3215c7e to your computer and use it in GitHub Desktop.
Save Tyralion/1be4e286b19da3215c7e to your computer and use it in GitHub Desktop.

Revisions

  1. @milmih milmih created this gist Aug 23, 2014.
    49 changes: 49 additions & 0 deletions rbenv-install.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    #!/usr/bin/env bash

    if [ "$UID" -ne 0 ]
    then echo "Please run this script as root user"
    exit
    fi

    apt-get -y update
    apt-get -y upgrade
    apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev git sqlite3 libsqlite3-dev

    git clone https://github.com/sstephenson/rbenv.git /usr/local/rbenv

    mkdir /usr/local/rbenv/plugins
    git clone https://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins

    cat <<EOF >> /etc/skel/.bashrc
    #### begin rbenv configuration ####
    ## Remove these lines if you wish to use your own
    ## clone of rbenv (with your own rubies)
    export RBENV_ROOT=/usr/local/rbenv
    export PATH="$RBENV_ROOT/bin:$PATH"
    eval "$(rbenv init -)"
    # Allow local Gem management
    export GEM_HOME="$HOME/.gem"
    export GEM_PATH="$HOME/.gem"
    export PATH="$HOME/.gem/bin:$PATH"
    #### end rbenv configuration ####
    EOF

    cat <<EOF >> ~/.bashrc
    #### begin rbenv configuration ####
    ## Remove these lines if you wish to use your own
    ## clone of rbenv (with your own rubies)
    export RBENV_ROOT=/usr/local/rbenv
    export PATH="$RBENV_ROOT/bin:$PATH"
    eval "$(rbenv init -)"
    #### end rbenv configuration ####
    EOF

    source ~/.bashrc
    rbenv install 2.1.2
    rbenv rehash
    rbenv global 2.1.2

    gem install rbenv-rehash --no-ri --no-rdocp
    1 change: 1 addition & 0 deletions suppress-gem-docs-gen.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    echo "gem: --no-rdoc --no-ri" > ~/.gemrc