Installing Rails6 on Raspberry Pi

Ruby on Rails is a web development framework that was first introduced in 1999. Despite it's "age", it's still a popular choice for developing web applications.

In this tutorial, I'm going to explain how to install Ruby on Rails 6 on Raspberry Pi. I'm going to assume that you have Raspbian installed on your Raspberry Pi.

Installing the Essentials

You should begin by installing the prerequisites, to prepare for the installation of Rails. Type the following command into the Terminal window.

{% highlight ruby linenos %} sudo apt-get update && sudo apt-get install -y git curl zlib1g-dev subversion {% endhighlight %}

While you're already getting the required packages, you'll need to retrieve the SSL package, SQL database package, and a few more.

{% highlight ruby linenos %} sudo apt-get install -y openssl libreadline6-dev git-core zlib1g libssl-dev sudo apt-get install -y libyaml-dev libsqlite3-dev sqlite3 sudo apt-get install -y libxml2-dev libxslt-dev sudo apt-get install -y autoconf automake libtool bison {% endhighlight %}

Open up the RVM, straight from its repository on GitHub with the help of curl.

{% highlight ruby linenos %} curl -L | bash -s stable --rails {% endhighlight %}

Once you've successfully installed the required packages, and have opened up the RVM, it's recommended that you run a local script, just so that you can enable Ruby.

{% highlight ruby linenos %} source ~/.rvm/scripts/rvm {% endhighlight %}

Testing the Installations

No "weird" error messages during this procedure is likely a good sign. You can test your new Ruby support by typing the following command.

{% highlight ruby linenos %} ruby -v {% endhighlight %}

You should see a message confirming which version of Ruby is installed, when it was produced, and what it's using in order to work correctly.

You can also test for Rails by typing in the following command. {% highlight ruby linenos %} rails -v {% endhighlight %}


Hopefully this was a simple walkthrough to show you how to setup the latest version of the Ruby on Rails web development framework on the Raspberry Pi. Rails is a very popular framework, so it's great to also have that option on the Raspberry Pi!

About the author

Hey, I'm Erik, a software engineer, gamer, writer, and content creator. I publish articles and tutorials about modern software development, design, and programming.

Get the newsletterBuy me a coffee