This article is half-done without your Comment! *** Please share your thoughts via Comment ***
PostgreSQL is a powerful, open source object-relational database system. It has more than 15 years of active development and a proven architecture that has earned it a strong reputation for reliability, data integrity, and correctness.
I am going to share few steps on how to install PostgreSQL 9.4 on Ubuntu 14.04.
First, check the version of Ubuntu:
1 |
lsb_release -sc |
You need to add the latest PostgreSQL repository for the latest version, otherwise It will install PostgreSQL 9.3. This is for trusty version.
1 |
sudo add-apt-repository "deb https://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" |
Update and Install PostgreSQL 9.4:
1 2 |
sudo apt-get update sudo apt-get install postgresql-9.4 |
Default postgres super user and postgres database is created. You need to set a password for the postgres super user.
1 2 3 4 |
ubuntu@:~$ sudo passwd postgres Enter new UNIX password:**** Retype new UNIX password:**** passwd: password updated successfully |
If service is not started, you can start the PostgreSQL service.
1 |
sudo service postgresql start |
Connect PostgreSQL server using postgres user:
1 2 |
ubuntu@:~$ su postgres Password:**** |
Create a sample database:
1 |
createdb database_name |
Connect to that database:
1 |
psql -d database_name |
Create a sample table:
1 |
create table Test (rno integer); |
Exit to database session:
1 |
\q |
Exit to PostgreSQL server:
1 |
exit |