14.8 C
Texas
angeloma
Senior Writer and partner

How to install Ruby on Rails on Debian 10 Buster?

Ruby is one of those programming languages that may be a little underestimated. However, it is a robust, multipurpose, open-source language that stands out for its efficiency in coding applications. Part of its popularity lies in the Ruby on Rails framework with which professional web applications can be made with relative ease. So, in this post, you will learn how to install Ruby on Rails on Debian 10.

Ruby on Rails makes Ruby more popular

The truth is that Ruby is still widely used today, but when compared to Python, PHP or Java is far behind. So it is no wonder it is not so easy to learn.

However, thanks to the efficiency of Ruby on Rails, many people have turned their eyes back to this language. Ruby on Rails is a fairly robust framework for creating web applications.

Some of the highlights of Ruby on Rails are as follows:

  • It uses many configuration conventions. This makes the framework, once installed, ready to work.
  • In Rails, there are several ways to do a certain thing. That is, it makes collaboration easier and the code easier to understand.
  • With Ruby on Rails, you’ll have a framework that uses the DRY (Don’t Repeat Yourself) principle. With this, duplicity is eliminated and it makes it very agile.
  • Open Source, so licensing should not be a problem for you.
- Advertisement -

If we add a robust and stable operating system like Debian to Ruby on Rails, then we have a great combination. So, let us start.

Install Ruby on Rails on Debian 10

Now we can start installing Ruby on Rails on Debian 10. The best way to do this is manually to get the latest stable version available. This way we will be able to take better advantage of its features.

First, start a new terminal session and run the following commands:

:~$ sudo apt install build-essential curl nodejs

1.- Install some required packages
1.- Install some required packages

Also install the following packages:

:~$ sudo apt install gawk autoconf automake bison libffi-dev libgdbm-dev libncurses5-dev libsqlite3-dev libtool libyaml-dev pkg-config sqlite3 zlib1g-dev libgmp-dev libreadline-dev libssl-dev

In case you do not have sudo enabled, I recommend you read our post about it.

How to enable sudo on Debian 10 Buster?

Now, you need to download the GPG key to install RVM (Ruby Version Manager) and then install Ruby.

:~$ curl -sSL https://rvm.io/mpapis.asc | sudo gpg --import -
:~$ curl -sSL https://rvm.io/pkuczynski.asc | sudo gpg --import -

Then, download the RVM script.

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

2.- Installing RVM on Debian 10
2.- Installing RVM on Debian 10

After that, refresh the bash profile.

:~$ source /etc/profile.d/rvm.sh

Now, check the version installed.

:~$ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]

Now it is your turn to install Ruby on Rails. At the time of writing this post, the latest stable version is 5.2.3. So to install it, just use this command as root:

:~$ su
:~# gem install rails -v 5.2.3

3.- Install Ruby on Rails on Debian 10
3.- Install Ruby on Rails on Debian 10

Now, we can start a new project.

Start a new Ruby on Rails project on Debian 10

Now we’re going to create a new project for Ruby on Rails. To do this, create a folder with the name of the project and access it. Of course, choose the path and the name.

:~# exit
:~$ mkdir /home/angelo/example
:~$ cd /home/angelo/example

So, create the project.

:~# rails new example

4.- Configuring Ruby on Rails on Debian 10
4.- Configuring Ruby on Rails on Debian 10

Note: If you can not use rails command. Just log out and log in again.

Now it is necessary to serve the project. For that it is enough to use this command:

:~# cd example
:~# rails s

5.- Serving the new project
5.- Serving the new project

Note: you can run bundle install command to install all gem missed. After that, run rails s command again.

Also, you can specify an IP address and port.

:~# rails server --binding [Ip_address] --port [Port]

Finally, open your web browser and go to http://SERVER-IP:3000 and you will see this.

6.- Ruby on Rails working on Debian 10
6.- Ruby on Rails working on Debian 10

So, that is it.

Conclusion

Thanks to Ruby on Rails you can create great web applications for the market. All this, thanks to the potential of Ruby as a language and the structure of this framework. Using it with Debian 10 as a system is a guarantee of success.

Please share this post with your friends and join our Telegram channel.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article