Ruby on Rails, often simply called Rails, is a powerful web application framework written in Ruby. It follows the model-view-controller (MVC) architecture and emphasizes convention over configuration. This guide will walk you through the steps to install Ruby on Rails on a Rocky Linux 8.10 system.
Prerequisites
Before starting, ensure you have:
- A running Rocky Linux 8.10 system
- A user account with sudo privileges
- Internet connectivity to download packages
Step 1: Update Your System
Start by updating your system to ensure all existing packages are up to date.
Step 2: Install Dependencies
Install essential development tools and libraries required for building Ruby and other dependencies:
Step 3: Install RVM (Ruby Version Manager)
RVM is a command-line tool which allows you to easily install, manage, and work with multiple Ruby environments.
Add the GPG Key
Install RVM
Install RVM by running the following command:
Load RVM into your shell session:
Step 4: Install Ruby
With RVM installed, you can now install Ruby. For this guide, we’ll install the latest stable version of Ruby.
Verify the Ruby installation:
You should see output similar to:
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 Yarn
Add the Yarn repository and install Yarn:
Step 6: Install Rails
Finally, install Rails using the gem package manager:
Verify the Rails installation:
You should see output similar to:
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:
Step 8: Start the Rails Server
Start the Rails server to make sure your application is running correctly:
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 Rocky Linux 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.