Postgres: Difference between revisions

From Bashlinux
Jump to navigationJump to search
Content deleted Content added
Manpaz (talk | contribs)
No edit summary
Manpaz (talk | contribs)
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
= PostgreSQL =
== How to install and do the initialize postgres ==
# Install postgresql packages
<pre><nowiki>
yum install postgresql postgresql-server
</nowiki></pre>


== How to install and initialize postgres ==
# Initialize DB
* Install postgresql packages
CentOS
<pre><nowiki>
# yum install postgresql postgresql-server
mkdir /var/lib/pgsql/data
Ubuntu
chown postgres /var/lib/pgsql/data
# apt-get install postgresql
su - postgres
initdb -D /var/lib/pgsql/data
</nowiki></pre>


* Initialize the DB
# Start postgres
# mkdir /var/lib/pgsql/data
# chown postgres /var/lib/pgsql/data
<pre><nowiki>
# su - postgres
pg_ctl -D /usr/local/pgsql/data -l -logfile start
> initdb -D /var/lib/pgsql/data
</nowiki></pre>

* Start postgres
# pg_ctl -D /usr/local/pgsql/data -l -logfile start

Revision as of 03:23, 3 June 2015


How to install and initialize postgres

  • Install postgresql packages

CentOS

# yum install postgresql postgresql-server

Ubuntu

# apt-get install postgresql
  • 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