Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ijin/4005270 to your computer and use it in GitHub Desktop.
Save ijin/4005270 to your computer and use it in GitHub Desktop.
CentOS: rbenv install and system wide install
# CentOS rbenv system wide installation script
# Forked from https://gist.github.com/1237417
# Installs rbenv system wide on CentOS 5/6, also allows single user installs.
# Install pre-requirements
yum groupinstall "Development Tools"
yum install git-core openssl-devel readline-devel
# Check Git has been installed
hash git 2>&- || {
echo >&2 "Error: Git not found. Hint: Try installing the RPMForge or EPEL package repository."; exit 1;
}
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Add rbenv to the path
echo '# rbenv setup - only add RBENV PATH variables if no single user install found' > /etc/profile.d/rbenv.sh
echo 'if [[ ! -d "${HOME}/.rbenv" ]]; then' >> /etc/profile.d/rbenv.sh
echo ' export RBENV_ROOT=/usr/local/rbenv' >> /etc/profile.d/rbenv.sh
echo ' export PATH="$RBENV_ROOT/bin:$PATH"' >> /etc/profile.d/rbenv.sh
echo ' eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh
echo 'fi' >> /etc/profile.d/rbenv.sh
chmod +x /etc/profile.d/rbenv.sh
source /etc/profile.d/rbenv.sh
# Install ruby-build:
pushd /tmp
git clone git://github.com/sstephenson/ruby-build.git
cd ruby-build
./install.sh
popd
# Install Ruby 1.9.3-p0
rbenv install 1.9.3-p0
rbenv global 1.9.3-p0
# Rehash:
rbenv rehash
# CentOS rbenv installation script
# Forked from https://gist.github.com/1237417
# Installs rbenv to user home on CentOS 5/6.
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
# Add rbenv to the path
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> .bash_profile
echo 'eval "$(rbenv init -)"' >> .bash_profile
source ~/.bash_profile
echo '---------------------------------'
echo " rbenv installed to $HOME/.rbenv"
echo " Restart your shell if an existing system wide installation exists!"
echo '---------------------------------'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment