Created
May 14, 2012 03:10
-
-
Save FernandoEscher/2691561 to your computer and use it in GitHub Desktop.
Configuración de Postgresql para Rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install latest version of postgresql | |
sudo apt-get install postgresql | |
# Access the console with the postgres role to the postgres database | |
sudo -u postgres psql postgres | |
# Create rol YourAppName | |
create role YourAppName with createdb login password 'YourAppRolePassword'; | |
# Verify that the rol has been created | |
select * from pg_user; | |
# Verify that the rol has been created with a password | |
select * from pg_shadow; | |
# Create your application's databases (only the production on is required) | |
create database YourAppName_development owner YourAppName; | |
create database YourAppName_test owner YourAppName; | |
create database YourAppName_production owner YourAppName; | |
# Exit the postgresql console | |
\q | |
# Open the configuration file to set how Postgresql will authenticate to your database | |
sudo vim /etc/postgresql/9.1/main/pg_hba.conf | |
# Add these lines just after the line that has TYPE, DATABASE, USER, ADDRESS, METHOD, and then save (only the production one is required). | |
local YourAppName_production YourAppName md5 | |
local YourAppName_development YourAppName md5 | |
local YourAppName_test YourAppName md5 | |
# Restart the Postgresql service | |
sudo service postgresql restart | |
# If you didn't get any errors following these steps, the Postgresql service should restart without any problems. | |
# After all of this you can run "rake db:migrate" and "rake db:seed" to generate your database schema and initial data. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment