Install postgresql 9.4 and configure it for Ruby on Rails
PostgreSQL is available in the default repositories. So enter the following command from the Terminal to install it.
If you’re looking for other versions, add the PostgreSQL repository, and install it as shown below.sudo apt-get install postgresql postgresql-contrib
On Ubuntu 14.10 systems:
Create the file /etc/apt/sources.list.d/pgdg.list;
Add a line for the repository:vi /etc/apt/sources.list.d/pgdg.list
On Ubuntu 14.04, add the following line:deb http://apt.postgresql.org/pub/repos/apt/ utopic-pgdg main
On Ubuntu 12.04, add the following line:deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main
Import the repository signing key:deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main
Update the package lists:wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc sudo apt-key add -
Then install the required version.sudo apt-get update
sudo apt-get install postgresql-9.4
Access PostgreSQL command prompt :
The default database name and database user are “postgres”. Switch to postgres user to perform postgresql related operations:sudo -u postgres psql postgres
If this command is not work, you can use it –
sudo sudo -u postgres psql
Sample Output:
psql (9.4rc1) Type "help" for help. postgres=#
Now Create database –
postgres=# create database “cc_database”;
So a list of command in terminal is .
$ createuser ubuntu -dslP
$ Enter password for new role: **same password from your yaml file**
$ Enter it again:
You can test the user –
$ echo $USER
Set your yaml file like this
development: adapter: postgresql encoding: utf8 database: cc_database pool: 5 username: ubuntu password: password
Comments
Post a Comment