sexta-feira, 17 de abril de 2015

How to install PostgreSql 9.4 on Ubuntu Desktop 14.04 (Trusty)

1. Introduction


This post gathers information about installing PostgreSql 9.4 on Linux Ubuntu Desktop 14.04 (Trusty)


2. Step-by-Step

  • Add apt repository
$ sudo vim /etc/apt/sources.list.d/pgdg.list 
# PostgreSQL 9.4 
deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main


  • Import the repository signing key, and update the package lists
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
  sudo apt-key add -
sudo apt-get update


  • Install PostgreSQL
$ sudo apt-get install postgresql-9.4
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  dkms
Use 'apt-get autoremove' to remove it.
The following extra packages will be installed:
  libpq5 pgdg-keyring postgresql-client-9.4 postgresql-client-common
  postgresql-common
Suggested packages:
  oidentd ident-server locales-all postgresql-doc-9.4
The following NEW packages will be installed:
  libpq5 pgdg-keyring postgresql-9.4 postgresql-client-9.4
  postgresql-client-common postgresql-common
0 upgraded, 6 newly installed, 0 to remove and 382 not upgraded.
Need to get 4.921 kB of archives.
After this operation, 23,6 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
  :
* Starting PostgreSQL 9.4 database server                               [ OK ] 


  • Connect to PostgreSQL 9.4 and check basic

$ sudo su - postgres
$ psql 
psql (9.4.1)
Type "help" for help.

postgres=# \l
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+---------------------
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres         
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres         
           |          |          |             |             | postgres=CTc/postgres
(3 rows)
postgres=# select schemaname, count(*) from pg_tables group by schemaname;
     schemaname     | count 
--------------------+-------
 information_schema |     7
 pg_catalog         |    51
(2 rows)





3. References


Nenhum comentário:

Postar um comentário