How to build a Ruby on Rails app on AWS for beginners – Part 1.

This is part one of a series of posts, this post covers the initial provisioning of a Ruby on Rails app on AWS using LightSail which is the simplest way of getting started with compute and databases on AWS.

Let’s get started by creating an AWS accoun…


This content originally appeared on DEV Community and was authored by Lee Wynne

This is part one of a series of posts, this post covers the initial provisioning of a Ruby on Rails app on AWS using LightSail which is the simplest way of getting started with compute and databases on AWS.

Let's get started by creating an AWS account and building a Linux host to run our Ruby on Rails app with AWS LightSail.

Provisioning a Linux instance to run a Ruby on Rails app on AWS LightSail.

This post will guide you through getting started with your first AWS LightSail compute instance. Before you follow the article though, you need to remember to choose Ubuntu as the OS as per below:

aws Ruby on Rails host

Then select your plan (I chose the $10 for now)

aws Ruby on Rails host ec2 or lightsail

Okay, once that's done, click on the little command line icon next to you instance and you should get a new console tab, all logged in and ready to go.

Screenshot 2021-02-17 at 12.33.07

Installing Node and Yarn to support Webpacker in Ruby on Rails.

sudo apt install curl
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs yarn

Installing rbenv and then Ruby

Great, let's install a Ruby. We are going to install it using rbenv which allows you to run multiple versions of Ruby side by side if needed.

cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

rbenv install 3.0.0
rbenv global 3.0.0
ruby -v

Now all we need to do is install bundler

gem install bundler

Next up, installing Rails

gem install rails -v 6.1.3.2

To make the Rails executable available:

rbenv rehash

Check you have everything installed (this should return the installed version):

rails -v

Job done next up this series is installing PostgreSQL for the DB.


This content originally appeared on DEV Community and was authored by Lee Wynne


Print Share Comment Cite Upload Translate Updates
APA

Lee Wynne | Sciencx (2021-06-29T14:28:28+00:00) How to build a Ruby on Rails app on AWS for beginners – Part 1.. Retrieved from https://www.scien.cx/2021/06/29/how-to-build-a-ruby-on-rails-app-on-aws-for-beginners-part-1/

MLA
" » How to build a Ruby on Rails app on AWS for beginners – Part 1.." Lee Wynne | Sciencx - Tuesday June 29, 2021, https://www.scien.cx/2021/06/29/how-to-build-a-ruby-on-rails-app-on-aws-for-beginners-part-1/
HARVARD
Lee Wynne | Sciencx Tuesday June 29, 2021 » How to build a Ruby on Rails app on AWS for beginners – Part 1.., viewed ,<https://www.scien.cx/2021/06/29/how-to-build-a-ruby-on-rails-app-on-aws-for-beginners-part-1/>
VANCOUVER
Lee Wynne | Sciencx - » How to build a Ruby on Rails app on AWS for beginners – Part 1.. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/06/29/how-to-build-a-ruby-on-rails-app-on-aws-for-beginners-part-1/
CHICAGO
" » How to build a Ruby on Rails app on AWS for beginners – Part 1.." Lee Wynne | Sciencx - Accessed . https://www.scien.cx/2021/06/29/how-to-build-a-ruby-on-rails-app-on-aws-for-beginners-part-1/
IEEE
" » How to build a Ruby on Rails app on AWS for beginners – Part 1.." Lee Wynne | Sciencx [Online]. Available: https://www.scien.cx/2021/06/29/how-to-build-a-ruby-on-rails-app-on-aws-for-beginners-part-1/. [Accessed: ]
rf:citation
» How to build a Ruby on Rails app on AWS for beginners – Part 1. | Lee Wynne | Sciencx | https://www.scien.cx/2021/06/29/how-to-build-a-ruby-on-rails-app-on-aws-for-beginners-part-1/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.