Skip to content

Instantly share code, notes, and snippets.

@vddgil
Forked from markkanof/rbenv-install-system-wide.sh
Last active November 19, 2022 19:15
Show Gist options
  • Save vddgil/60dc2974ee3af3dcb53805174bbf1d8b to your computer and use it in GitHub Desktop.
Save vddgil/60dc2974ee3af3dcb53805174bbf1d8b to your computer and use it in GitHub Desktop.
rbenv install and system wide install on Ubuntu to /opt/rbenv
# Install nodenv
git clone https://github.com/nodenv/nodenv.git /opt/nodenv
# Add nodenv to the path:
echo '# nodenv setup' > /etc/profile.d/nodenv.sh
echo 'export NODENV_ROOT=/opt/nodenv' >> /etc/profile.d/nodenv.sh
echo 'export PATH="$NODENV_ROOT/bin:$PATH"' >> /etc/profile.d/nodenv.sh
echo 'eval "$(nodenv init -)"' >> /etc/profile.d/nodenv.sh
chmod +x /etc/profile.d/nodenv.sh
source /etc/profile.d/nodenv.sh
# Install nodenv-build:
mkdir -p "$(nodenv root)"/plugins
git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build
# Install Node:
nodenv install x.x.x
nodenv global x.x.x
# Rehash:
nodenv 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
apt-get -y install zlib1g-dev
apt-get -y install libssl-dev
apt-get -y install libreadline-dev
apt-get -y install libcurl4-openssl-dev
# Install rbenv
git clone https://github.com/sstephenson/rbenv.git /opt/rbenv
# Add rbenv to the path:
echo '# rbenv setup' > /etc/profile.d/rbenv.sh
echo 'export RBENV_ROOT=/opt/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 https://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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment