topics #fedora #git #linux #ruby

Learn Ruby: 1. Installing Ruby with asdf on Fedora Linux

Initial Setup

Start by installing development tools and utilities:

sudo dnf -y groupinstall "Development Tools"
sudo dnf install vim git curl wget zsh util-linux-user

For those who prefer zsh with Oh My Zsh:

sudo dnf install zsh util-linux-user
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Note: If you change a command language interpreter from bash to zsh, you need to restart your system.

Installing asdf and Ruby

Install system dependencies required for Ruby compilation on Fedora:

sudo dnf install -y gcc make bzip2 openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel

Clone asdf:

git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.9.0

Add this line to ~/.zshrc:

. $HOME/.asdf/asdf.sh

Add the Ruby plugin and install:

asdf plugin-add ruby
asdf install ruby latest
asdf global ruby latest

Verify installation:

ruby -v
=> ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux]

View installed runtimes:

asdf list