Home  »  ArticlesGuidesHow ToProgrammingTechnology   »   Set up to Install Ruby On Rails on AlmaLinux 8.10 Systems

Set up to Install Ruby On Rails on AlmaLinux 8.10 Systems

Ruby on Rails, often simply called Rails, is a powerful web application framework written in Ruby. It is designed to make programming web applications easier by making assumptions about what every developer needs to get started. This guide will walk you through the steps to install Ruby on Rails on AlmaLinux 8.10.

Prerequisites

Before starting, ensure you have:

  • A running AlmaLinux 8.10 system
  • A user account with sudo privileges
  • Internet connectivity to download necessary packages

Step 1: Update Your System

First, update your system to ensure all existing packages are up to date.

$ sudo dnf update -y

Step 2: Install Dependencies

Install essential development tools and libraries required for building Ruby and other dependencies.

$ sudo dnf groupinstall -y "Development Tools"
$ sudo dnf install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison sqlite-devel

Step 3: Install RVM (Ruby Version Manager)

RVM (Ruby Version Manager) allows you to install and manage multiple Ruby environments.

Install GPG Keys

Install the GPG keys required to use RVM.

$ sudo dnf install -y gpg
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

Install RVM

Download and install RVM.

$ curl -sSL https://get.rvm.io | bash -s stable

Load RVM into your shell session.

$ source ~/.rvm/scripts/rvm

Step 4: Install Ruby

With RVM installed, you can now install Ruby. For this guide, we’ll install the latest stable version of Ruby.

$ rvm install 3.1.2
$ rvm use 3.1.2 --default

Verify the Ruby installation.

$ ruby -v

You should see output similar to:

ruby 3.1.2p0 (2022-04-12 revision 0) [x86_64-linux]

Step 5: Install Node.js and Yarn

Rails uses Node.js for the Asset Pipeline, and Yarn is used to manage JavaScript dependencies.

Install Node.js

Install Node.js from the NodeSource repository.

$ curl -sL https://rpm.nodesource.com/setup_16.x | sudo bash -
$ sudo dnf install -y nodejs

Install Yarn

Add the Yarn repository and install Yarn.

$ curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
$ sudo dnf install -y yarn

Step 6: Install Rails

Finally, install Rails using the gem package manager.

$ gem install rails -v 7.0.3

Verify the Rails installation.

$ rails -v

You should see output similar to:

Rails 7.0.3

Step 7: Set Up a New Rails Application

To ensure everything is working correctly, create a new Rails application. Navigate to the directory where you want to create your application and run:

$ rails new myapp
$ cd myapp

Step 8: Start the Rails Server

Start the Rails server to make sure your application is running correctly.

$ rails server

Open a web browser and navigate to http://localhost:3000. You should see the Rails welcome page, indicating that everything is set up correctly.

Conclusion

You have successfully installed Ruby on Rails on your AlmaLinux 8.10 system. This powerful framework is now ready for you to start developing web applications. For more detailed configurations and optimizations, refer to the official documentation of each component:

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.