DEV Community

Bruno Queiroz
Bruno Queiroz

Posted on • Edited on

Install Ruby and Rails on Fedora 40

Ruby
A few weeks ago I’ve had a problem about install the Ruby on Rails development environment on Fedora 39. First I try the same tutorial that I always use to install Rails on Ubuntu/Debian and similar distros, but I’ve had some problems. If you’re using some Debian based distribution I strong recommends this article:

https://gorails.com/setup/ubuntu/22.04

But if you’re a Fedora user, and this is the reason that you stay here, let’s go! Fedora have one of the most stable and simple to use package manager among the Linux world called “dnf”, something strong like that is the Pacman for Arch Linux. Ok, let’s setup our system.

The first thing is obvious but stronger needed, update your system, so:

sudo dnf update -y
Enter fullscreen mode Exit fullscreen mode

The flag “-y” is the same thing to say “Yes” to install all the packages. Now let’s install some needed packages:

sudo dnf install git curl automake gcc gcc-c++ kernel-devel libyaml-devel -y 
Enter fullscreen mode Exit fullscreen mode

Now everything in our system is ok to build and install our ruby versions! In the last two years I've been using "asdf" for multiple versions of languages like Ruby, Node and Elixir and for now I don't have any intention to change to another. To learn more about asdf:

https://asdf-vm.com/

So, now let’s install “asdf” on our system:

cd
git clone https://github.com/excid3/asdf.git ~/.asdf
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc
echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.bashrc
echo 'legacy_version_file = yes' >> ~/.asdfrc
echo 'export EDITOR="code --wait"' >> ~/.bashrc
exec $SHELL
Enter fullscreen mode Exit fullscreen mode

Now we need to install the Ruby asdf plugin:

asdf plugin add ruby
Enter fullscreen mode Exit fullscreen mode

To install Ruby and set the default version, we’ll run the following commands:

asdf install ruby 3.3.1
asdf global ruby 3.3.1
echo "gem: --no-document" > ~/.gemrc
gem update --system
Enter fullscreen mode Exit fullscreen mode

Ruby installed, let’s install rails:

gem install rails
Enter fullscreen mode Exit fullscreen mode

And now everything is ok, let’s make something awesome!

rails -v
Enter fullscreen mode Exit fullscreen mode

Until the future!

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay