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 http://apt.postgresql.org/pub/repos/apt/ utopic-pgdg main
On Ubuntu 14.04, add the following line:
deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main
On Ubuntu 12.04, add the following line:
deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main
Import the repository signing key:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc 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. 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

Popular Posts

Install and configure Network simulator (ns3) on Ubuntu 14.04