How to Install Ruby on Rails Ubuntu 20.04. In this tutorial we will introduce Ruby on Rails (ROR) with it’s main features and move onto installation phase with Node.js and Yarn install. There is 2 way installation tutorial of ROR: Ruby using rbenv and with RVM.
Ruby on Rails is one of the most popular server side and e commerce web development framework. Ruby on Rails framework is a highly stable and powerful platform for building an E-commerce website.
What Is Ruby On Rails
Ruby on Rails (ROR) or Rails is an open source web application development framework, which is created using a general purpose programming language, Ruby. It runs on Linux and ROR is a dynamic fully object oriented and scripting language. It constitutes a collective code library, delivering both apps and web developers convenient solutions to eliminate time consuming and redundant tasks.
Ruby on Rails server helps you to find code for basic functions instead of writing every single code in a program afresh. She further added that while other frameworks naturally make the development of a complex website manageable, Ruby on Rails is known for its effortless maintenance and lending itself out to collaboration.
Moreover, the two primary principles of Ruby are:
Don’t Repeat Yourself (DRY) – It is a principle of software development stating that every piece of knowledge must have a single, unambiguous and authoritative representation within a system. It eliminates the need for writing the same information consistently, making it more manageable, extensible and less buggy.
Convention Over Configuration – Rails is a multi purpose web application development framework and has this set of conventions by default.
Ruby on Rails provides you with the benefits that are as given below:
Cost Effective
Ruby on Rails is an open source framework that is 100 percent free and is capable of running on Linux. Developers find this framework quite efficient to work with. It provides you with numerous plugins that help you save time and makes the development and management more straightforward.
Faster Development
ROR contains many ready made plugins and modules where developers and teams can build applications 30–40% faster than teams using other programming languages and frameworks.
Easy Code Maintenance and Updates
Web developers highly rely on Ruby on Rails because of its stability and predictability. It makes the process of modifying existing code and adding new features to the site relatively effortless. Whether you want to update an application or refract its code, it provides a convention that allows you to do so immediately.
Build On Model View Controller (MVC) Architecture
In this architecture, the web application has three interconnected layers. The model contains codes that run on application data. Centralize application business logic and data processing rules. The controller communicates with models and views. It receives a request from the browser, works with the model to process it and instructs the user how to display the result correctly.
Quality Product
Not only did RoR save your time and money but also helps in providing a high quality product. It is susceptible to fewer risks and can build the website, following the principles of good development more effectively. It is all because of its high quality libraries. This way you focus on exploring your business needs and creating a better product. It also promotes testing automation that assists you in delivering better software.
Manages Changes Effortlessly
With Ruby on Rails tools you can easily modify the existing codes or add new features to your site. It is the most effective frameworks if you are working on long term projects as they are highly stable and predictable.
Secure
The framework has in built security measures, meaning that they follow the secure development lifecycle that actively works to spot and patch vulnerabilities. This makes the framework well documented both officially and unofficially. Hence, you don’t have to worry about your site’s security.
Next, you will need to install Node.js server and Yarn package to your server. By default, the latest version of Node.js is not available in the Ubuntu 20.04 default repository. So you will need to add the Node source repository to APT. You can add it using the following command:
You can use the gem command line utility to install the latest version of Rails as shown below:
gem install rails
To verify the Rails version, run the following command:
rails -v
Output:
Rails 6.0.3.1
Create a Rails Application
In this section, we will create a simple Rails application to check the Ruby on Rails installation.
Let’s create a simple application named myapp with the following command:
rails new myapp
You can see all files and directories created by the above command using the following command:
cd myapp
ls
Output:
app bin config config.ru db Gemfile Gemfile.lock lib log public Rakefile README.md storage test tmp vendor
Now, start the Rails application using the following command:
rails server -b 0.0.0.0
Once the application is started, you will get the following output:
=> Booting Puma
=> Rails 7.0.2.3 application starting in development
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 5.6.4 (ruby 3.0.3-p157) ("Birdie's Version")
* Min threads: 5
* Max threads: 5
* Environment: development
* PID: 29540
* Listening on http://0.0.0.0:3000
Use Ctrl-C to stop
Access Ruby on Rails app
Now, open your web browser and access your Rails application using the URL http://your-server-ip:3000. You should see the Rails application page on the following screen:
In this article, we explained how to install Ruby on Rails on Ubuntu 20.04 server using two different methods. We also explained how to create a simple Rails application. You can now start developing your own Rails application.
I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.
21vote
Article Rating
Subscribe
Login and comment with
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.
DisagreeAgree
Login and comment with
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.