Wednesday, August 5, 2015

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.
sudo apt-get install postgresql postgresql-contrib
If you’re looking for other versions, add the PostgreSQL repository, and install it as shown below.

On Ubuntu 14.10 systems:
Create the file /etc/apt/sources.list.d/pgdg.list;
vi /etc/apt/sources.list.d/pgdg.list
Add a line for the repository:
 deb utopic-pgdg main
On Ubuntu 14.04, add the following line:
deb trusty-pgdg main
On Ubuntu 12.04, add the following line:
deb precise-pgdg main
Import the repository signing key:
wget --quiet -O -
sudo apt-key add -
Update the package lists:
sudo apt-get update
Then install the required version.
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.


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

adapter: postgresql

encoding: utf8

database: cc_database

pool: 5

username: ubuntu

password: password

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.