Last active
April 22, 2024 06:00
-
-
Save tgran2028/7a589ceec17d94eac2e31399095b2545 to your computer and use it in GitHub Desktop.
Use rbenv and ruby-build to install Ruby.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Ruby Installation Script for OpenProject | |
# https://www.openproject.org/docs/development/development-environment-ubuntu/ | |
# | |
# This script installs Ruby using rbenv and ruby-build on Ubuntu. | |
# It assumes the user has administrative privileges and uses Bash shell. | |
# Install dependencies required for rbenv and Ruby | |
echo "Installing required packages..." | |
sudo apt-get update && sudo apt-get install -y \ | |
git-core curl zlib1g-dev build-essential \ | |
libssl-dev libreadline-dev libyaml-dev libsqlite3-dev \ | |
sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev \ | |
software-properties-common libffi-dev | |
# Clone rbenv repository into the home directory | |
echo "Cloning rbenv into ~/.rbenv..." | |
git clone https://github.com/rbenv/rbenv.git ~/.rbenv | |
# Add rbenv to PATH and initialize it on shell startup | |
echo "Setting up rbenv..." | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' | tee -a ~/.bashrc ~/.zshrc | |
echo 'eval "$(rbenv init -)"' | tee -a ~/.bashrc ~/.zshrc | |
source ~/.bashrc | |
# Clone ruby-build as a rbenv plugin | |
echo "Cloning ruby-build..." | |
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build | |
# Install Ruby using rbenv | |
echo "Installing Ruby version 3.2.3..." | |
rbenv install 3.2.3 | |
rbenv global 3.2.3 | |
rbenv rehash | |
# Verify the Ruby installation | |
echo "Ruby installation complete. Verifying installation..." | |
ruby -v | |
echo "Installation script finished. Ruby version $(ruby -v) installed successfully." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment