-
-
Save jnx/1256593 to your computer and use it in GitHub Desktop.
# Update, upgrade and install development tools: | |
apt-get update | |
apt-get -y upgrade | |
apt-get -y install build-essential | |
apt-get -y install git-core | |
# Install rbenv | |
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv | |
# Add rbenv to the path: | |
echo '# rbenv setup' > /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 | |
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.2-p290: | |
rbenv install 1.9.2-p290 | |
rbenv global 1.9.2-p290 | |
# Rehash: | |
rbenv rehash |
# Update, upgrade and install development tools: | |
apt-get update | |
apt-get -y upgrade | |
apt-get -y install build-essential | |
apt-get -y install git-core | |
# 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 | |
# Install ruby-build: | |
pushd /tmp | |
git clone git://github.com/sstephenson/ruby-build.git | |
cd ruby-build | |
./install.sh | |
popd | |
# Install Ruby 1.9.2-p290: | |
rbenv install 1.9.2-p290 | |
rbenv global 1.9.2-p290 | |
# Rehash: | |
rbenv rehash |
Unfortunately your script doesn't work :(
$ gem install bundler
Fetching: bundler-1.2.0.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /usr/local/rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1 directory.
$ sudo gem install bundler
sudo: gem: command not found
Do you plan to fix and update it somehow?
Thanks!
Some comments would be helpful. Like when do I need one script vs the other and of it works on other versions of ubuntu.
Everything is working great until i close the session. I'm using ubuntu 12.04, problem is I have to run source /etc/profile.d/rbenv.sh
every time inorder to use rbenv
@seifsallam, you can add source /etc/profile.d/rbenv.sh
to your ~/bash.rc
so you don't need to run that line again for each console instance.
You also need sudo apt-get install libssl-dev
Good start on instructions for global installation for rbenv. I'm not a linux expert but I think it's helpful to also set the "gid" bit on rbenv folders to ensure that as new folders are created they inherit from the group:
find /usr/local/rbenv -type d -exec chmod -R g+s '{}' \;
Additionally you are installing ruby-build as a separate installation. It's better to install it as an rbenv plugin:
mkdir -p /usr/local/rbenv/plugins/ruby-build
git clone https://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins/ruby-build
Then you should be able to say rbenv install 2.1.5
and get rbenv to do all the work (and configure/rehash itself after).
echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh
is causing an endless loop which ends up taking 100% memory on reboot. Anyone else have this problem?
Note that
rbenv-install.sh
expects to run with~
as the working directory.