11.2. Setting up the database
Rails applications are almost always used with a database. For local development use the PostgreSQL database.
Procedure
Install the database:
$ sudo yum install -y postgresql postgresql-server postgresql-devel
Initialize the database:
$ sudo postgresql-setup initdb
This command creates the
/var/lib/pgsql/data
directory, in which the data is stored.Start the database:
$ sudo systemctl start postgresql.service
When the database is running, create your
rails
user:$ sudo -u postgres createuser -s rails
Note that the user created has no password.