Difference between revisions of "Postgres"

From Bashlinux
Jump to: navigation, search
 
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
=== How to install Postgres ===
 
== How to install and initialize postgres ==
 
 
* Install postgresql packages
 
* Install postgresql packages
CentOS
+
: '''CentOS'''<br>
 
# yum install postgresql postgresql-server
 
# yum install postgresql postgresql-server
Ubuntu
+
: '''Ubuntu'''<br>
 
# apt-get install postgresql
 
# apt-get install postgresql
   
* Initialize the DB
+
=== How to initialize the DB ===
 
# mkdir /var/lib/pgsql/data
 
# mkdir /var/lib/pgsql/data
 
# chown postgres /var/lib/pgsql/data
 
# chown postgres /var/lib/pgsql/data

Latest revision as of 02:00, 10 June 2015

How to install Postgres

  • Install postgresql packages
CentOS
# yum install postgresql postgresql-server
Ubuntu
# apt-get install postgresql

How to initialize the DB

# mkdir /var/lib/pgsql/data
# chown postgres /var/lib/pgsql/data
# su - postgres
> initdb -D /var/lib/pgsql/data  
  • Start postgres
# pg_ctl -D /usr/local/pgsql/data -l -logfile start