Skip to content

Instantly share code, notes, and snippets.

@cboulanger
Last active March 30, 2023 14:29
Show Gist options
  • Save cboulanger/f358273bda7ca330aa77d22f656b0750 to your computer and use it in GitHub Desktop.
Save cboulanger/f358273bda7ca330aa77d22f656b0750 to your computer and use it in GitHub Desktop.
Install ruby 3.2.1 via rbenv on ubuntu and python 3.11 via pyenv - run as root!
#!/usr/bin/env bash
# run as root user
apt install -y git ruby-dev curl
# RUBY
cd ~
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'eval "$(~/.rbenv/bin/rbenv init - bash)"' >> ~/.bashrc
source ~/.bashrc
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
apt update && apt upgrade -y
apt install -y autoconf bison patch build-essential rustc libssl-dev libyaml-dev libreadline6-dev \
zlib1g-dev libgmp-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev uuid-dev \
libglib2.0-dev libxml2-dev libjq-dev
rbenv global 3.2.1
RUBYJQ_USE_SYSTEM_LIBRARIES=1 gem install ruby-jq
# PYTHON
apt install -y git gcc make openssl libssl-dev libbz2-dev libreadline-dev libsqlite3-dev zlib1g-dev \
libncursesw5-dev libgdbm-dev libc6-dev zlib1g-dev libsqlite3-dev tk-dev libssl-dev openssl libffi-dev \
lzma-dev
curl https://pyenv.run | bash
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
source ~/.bashrc
env PYTHON_CONFIGURE_OPTS=--enable-shared pyenv install 3.11
pyenv global 3.11
pip install pip --upgrade
pip install pipenv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment