- All guides / Install Ruby on Rails on Ubuntu 16.04 Xenial Xerus
- Overview
- Installing Ruby
- Configuring Git
- Installing Rails
- Setting Up A Database
- Setting Up MySQL
- Setting Up PostgreSQL
- Final Steps
- All guides / Install Ruby on Rails on Ubuntu 20.04 Focal Fossa
- Overview
- Installing Ruby
- Configuring Git
- Installing Rails
- Setting Up A Database
- Setting Up MySQL
- Setting Up PostgreSQL
- Final Steps
- All guides / Install Ruby on Rails on Ubuntu 21.04 Hirsute Hippo
- Overview
- Installing Ruby
- Configuring Git
- Installing Rails
- Setting Up A Database
- Setting Up MySQL
- Setting Up PostgreSQL
- Final Steps
All guides / Install Ruby on Rails on Ubuntu 16.04 Xenial Xerus
A guide to setting up a Ruby on Rails development environment
Operating System
Version
Overview
This will take about 30 minutes.
We will be setting up a Ruby on Rails development environment on Ubuntu 16.04 Xenial Xerus.
The reason we’re going to be using Ubuntu is because the majority of code you write will run on a Linux server. Ubuntu is one of the easiest Linux distributions to use with lots of documentation so it’s a great one to start with.
You’ll want to download the latest Desktop version here: http://releases.ubuntu.com/16.04/
Some of you may choose to develop on Ubuntu Server so that your development environment matches your production server. You can find it on the same download link above.
Installing Ruby
Choose the version of Ruby you want to install:
The first step is to install some dependencies for Ruby and Rails.
To make sure we have everything necessary for Webpacker support in Rails, we’re first going to start by adding the Node.js and Yarn repositories to our system before installing them.
Next we’re going to be installing Ruby using one of three methods. Each have their own benefits, most people prefer using rbenv these days, but if you’re familiar with rvm you can follow those steps as well. I’ve included instructions for installing from source as well, but in general, you’ll want to choose either rbenv or rvm.
Choose one method. Some of these conflict with each other, so choose the one that sounds the most interesting to you, or go with my suggestion, rbenv.
Installing with rbenv is a simple two step process. First you install rbenv , and then ruby-build :
The installation for rvm is pretty simple:
Arguably the least useful Ruby setup for development is installing from source, but I thought I’d give you the steps anyways:
The last step is to install Bundler
rbenv users need to run rbenv rehash after installing bundler.
Configuring Git
We’ll be using Git for our version control system so we’re going to set it up to match our Github account. If you don’t already have a Github account, make sure to register. It will come in handy for the future.
Replace my name and email address in the following steps with the ones you used for your Github account.
The next step is to take the newly generated SSH key and add it to your Github account. You want to copy and paste the output of the following command and paste it here.
Once you’ve done this, you can check and see if it worked:
You should get a message like this:
Installing Rails
Choose the version of Rails you want to install:
If you’re using rbenv, you’ll need to run the following command to make the rails executable available:
Now that you’ve installed Rails, you can run the rails -v command to make sure you have everything installed correctly:
If you get a different result for some reason, it means your environment may not be setup properly.
Setting Up A Database
Rails ships with sqlite3 as the default database. Chances are you won’t want to use it because it’s stored as a simple file on disk. You’ll probably want something more robust like MySQL or PostgreSQL.
There is a lot of documentation on both, so you can just pick one that seems like you’ll be more comfortable with.
If you’re new to Ruby on Rails or databases in general, I strongly recommend setting up PostgreSQL.
If you’re coming from PHP, you may already be familiar with MySQL.
Setting Up MySQL
Rails ships with sqlite3 as the default database. Chances are you won’t want to use it because it’s stored as a simple file on disk. You’ll probably want something more robust like MySQL or PostgreSQL.
There is a lot of documentation on both, so you can just pick one that seems like you’ll be more comfortable with.
If you’re new to Ruby on Rails or databases in general, I strongly recommend setting up PostgreSQL.
If you’re coming from PHP, you may already be familiar with MySQL.
You can install MySQL server and client from the packages in the Ubuntu repository. As part of the installation process, you’ll set the password for the root user. This information will go into your Rails app’s database.yml file in the future.
Installing the libmysqlclient-dev gives you the necessary files to compile the mysql2 gem which is what Rails will use to connect to MySQL when you setup your Rails app.
When you’re finished, you can skip to the Final Steps.
Setting Up PostgreSQL
For PostgreSQL, we’re going to add a new repository to easily install a recent version of Postgres.
The postgres installation doesn’t setup a user for you, so you’ll need to follow these steps to create a user with permission to create databases. Feel free to replace chris with your username.
Final Steps
And now for the moment of truth. Let’s create your first Rails application:
You can now visit http://localhost:3000 to view your new website!
Now that you’ve got your machine setup, it’s time to start building some Rails applications.
Источник
All guides / Install Ruby on Rails on Ubuntu 20.04 Focal Fossa
A guide to setting up a Ruby on Rails development environment
Operating System
Version
Overview
This will take about 30 minutes.
We will be setting up a Ruby on Rails development environment on Ubuntu 20.04 Focal Fossa.
The reason we’re going to be using Ubuntu is because the majority of code you write will run on a Linux server. Ubuntu is one of the easiest Linux distributions to use with lots of documentation so it’s a great one to start with.
You’ll want to download the latest Desktop version here: http://releases.ubuntu.com/20.04/
Some of you may choose to develop on Ubuntu Server so that your development environment matches your production server. You can find it on the same download link above.
Installing Ruby
Choose the version of Ruby you want to install:
The first step is to install some dependencies for Ruby and Rails.
To make sure we have everything necessary for Webpacker support in Rails, we’re first going to start by adding the Node.js and Yarn repositories to our system before installing them.
Next we’re going to be installing Ruby using one of three methods. Each have their own benefits, most people prefer using rbenv these days, but if you’re familiar with rvm you can follow those steps as well. I’ve included instructions for installing from source as well, but in general, you’ll want to choose either rbenv or rvm.
Choose one method. Some of these conflict with each other, so choose the one that sounds the most interesting to you, or go with my suggestion, rbenv.
Installing with rbenv is a simple two step process. First you install rbenv , and then ruby-build :
The installation for rvm is pretty simple:
Arguably the least useful Ruby setup for development is installing from source, but I thought I’d give you the steps anyways:
The last step is to install Bundler
rbenv users need to run rbenv rehash after installing bundler.
Configuring Git
We’ll be using Git for our version control system so we’re going to set it up to match our Github account. If you don’t already have a Github account, make sure to register. It will come in handy for the future.
Replace my name and email address in the following steps with the ones you used for your Github account.
The next step is to take the newly generated SSH key and add it to your Github account. You want to copy and paste the output of the following command and paste it here.
Once you’ve done this, you can check and see if it worked:
You should get a message like this:
Installing Rails
Choose the version of Rails you want to install:
If you’re using rbenv, you’ll need to run the following command to make the rails executable available:
Now that you’ve installed Rails, you can run the rails -v command to make sure you have everything installed correctly:
If you get a different result for some reason, it means your environment may not be setup properly.
Setting Up A Database
Rails ships with sqlite3 as the default database. Chances are you won’t want to use it because it’s stored as a simple file on disk. You’ll probably want something more robust like MySQL or PostgreSQL.
There is a lot of documentation on both, so you can just pick one that seems like you’ll be more comfortable with.
If you’re new to Ruby on Rails or databases in general, I strongly recommend setting up PostgreSQL.
If you’re coming from PHP, you may already be familiar with MySQL.
Setting Up MySQL
Rails ships with sqlite3 as the default database. Chances are you won’t want to use it because it’s stored as a simple file on disk. You’ll probably want something more robust like MySQL or PostgreSQL.
There is a lot of documentation on both, so you can just pick one that seems like you’ll be more comfortable with.
If you’re new to Ruby on Rails or databases in general, I strongly recommend setting up PostgreSQL.
If you’re coming from PHP, you may already be familiar with MySQL.
You can install MySQL server and client from the packages in the Ubuntu repository. As part of the installation process, you’ll set the password for the root user. This information will go into your Rails app’s database.yml file in the future.
Installing the libmysqlclient-dev gives you the necessary files to compile the mysql2 gem which is what Rails will use to connect to MySQL when you setup your Rails app.
When you’re finished, you can skip to the Final Steps.
Setting Up PostgreSQL
For PostgreSQL, we’re going to add a new repository to easily install a recent version of Postgres.
The postgres installation doesn’t setup a user for you, so you’ll need to follow these steps to create a user with permission to create databases. Feel free to replace chris with your username.
Final Steps
And now for the moment of truth. Let’s create your first Rails application:
You can now visit http://localhost:3000 to view your new website!
Now that you’ve got your machine setup, it’s time to start building some Rails applications.
Источник
All guides / Install Ruby on Rails on Ubuntu 21.04 Hirsute Hippo
A guide to setting up a Ruby on Rails development environment
Operating System
Version
Overview
This will take about 30 minutes.
We will be setting up a Ruby on Rails development environment on Ubuntu 21.04 Hirsute Hippo.
The reason we’re going to be using Ubuntu is because the majority of code you write will run on a Linux server. Ubuntu is one of the easiest Linux distributions to use with lots of documentation so it’s a great one to start with.
You’ll want to download the latest Desktop version here: http://releases.ubuntu.com/21.04/
Some of you may choose to develop on Ubuntu Server so that your development environment matches your production server. You can find it on the same download link above.
Installing Ruby
Choose the version of Ruby you want to install:
The first step is to install some dependencies for Ruby and Rails.
To make sure we have everything necessary for Webpacker support in Rails, we’re first going to start by adding the Node.js and Yarn repositories to our system before installing them.
Next we’re going to be installing Ruby using one of three methods. Each have their own benefits, most people prefer using rbenv these days, but if you’re familiar with rvm you can follow those steps as well. I’ve included instructions for installing from source as well, but in general, you’ll want to choose either rbenv or rvm.
Choose one method. Some of these conflict with each other, so choose the one that sounds the most interesting to you, or go with my suggestion, rbenv.
Installing with rbenv is a simple two step process. First you install rbenv , and then ruby-build :
The installation for rvm is pretty simple:
Arguably the least useful Ruby setup for development is installing from source, but I thought I’d give you the steps anyways:
The last step is to install Bundler
rbenv users need to run rbenv rehash after installing bundler.
Configuring Git
We’ll be using Git for our version control system so we’re going to set it up to match our Github account. If you don’t already have a Github account, make sure to register. It will come in handy for the future.
Replace my name and email address in the following steps with the ones you used for your Github account.
The next step is to take the newly generated SSH key and add it to your Github account. You want to copy and paste the output of the following command and paste it here.
Once you’ve done this, you can check and see if it worked:
You should get a message like this:
Installing Rails
Choose the version of Rails you want to install:
If you’re using rbenv, you’ll need to run the following command to make the rails executable available:
Now that you’ve installed Rails, you can run the rails -v command to make sure you have everything installed correctly:
If you get a different result for some reason, it means your environment may not be setup properly.
Setting Up A Database
Rails ships with sqlite3 as the default database. Chances are you won’t want to use it because it’s stored as a simple file on disk. You’ll probably want something more robust like MySQL or PostgreSQL.
There is a lot of documentation on both, so you can just pick one that seems like you’ll be more comfortable with.
If you’re new to Ruby on Rails or databases in general, I strongly recommend setting up PostgreSQL.
If you’re coming from PHP, you may already be familiar with MySQL.
Setting Up MySQL
Rails ships with sqlite3 as the default database. Chances are you won’t want to use it because it’s stored as a simple file on disk. You’ll probably want something more robust like MySQL or PostgreSQL.
There is a lot of documentation on both, so you can just pick one that seems like you’ll be more comfortable with.
If you’re new to Ruby on Rails or databases in general, I strongly recommend setting up PostgreSQL.
If you’re coming from PHP, you may already be familiar with MySQL.
You can install MySQL server and client from the packages in the Ubuntu repository. As part of the installation process, you’ll set the password for the root user. This information will go into your Rails app’s database.yml file in the future.
Installing the libmysqlclient-dev gives you the necessary files to compile the mysql2 gem which is what Rails will use to connect to MySQL when you setup your Rails app.
When you’re finished, you can skip to the Final Steps.
Setting Up PostgreSQL
For PostgreSQL, we’re going to add a new repository to easily install a recent version of Postgres.
The postgres installation doesn’t setup a user for you, so you’ll need to follow these steps to create a user with permission to create databases. Feel free to replace chris with your username.
Final Steps
And now for the moment of truth. Let’s create your first Rails application:
You can now visit http://localhost:3000 to view your new website!
Now that you’ve got your machine setup, it’s time to start building some Rails applications.
Источник