{"id":782,"date":"2015-02-25T11:06:17","date_gmt":"2015-02-25T18:06:17","guid":{"rendered":"http:\/\/homepages.uc.edu\/~yaozo\/wordpress\/?p=782"},"modified":"2015-02-25T11:06:17","modified_gmt":"2015-02-25T18:06:17","slug":"postgresql-installation-in-ubuntu-12-04","status":"publish","type":"post","link":"https:\/\/zhuoyao.net\/index.php\/2015\/02\/25\/postgresql-installation-in-ubuntu-12-04\/","title":{"rendered":"PostgreSQL installation in Ubuntu 12.04"},"content":{"rendered":"<p><strong><a title=\"PostgreSQL Homepage\" href=\"http:\/\/www.postgresql.org\/\">PostgreSQL<\/a>\u00a0is a powerful and reliable object-relational database system. It\u2019s a great alternative for MySQL. It is as easy to set up, performs better and offers far more features.<\/strong><\/p>\n<p>1. Make sure you already have install\u00a0<strong>python-software-properties<\/strong><\/p>\n<pre>$sudo apt-get install python-software-properties<\/pre>\n<p>2.Add PPA repository to my Ubuntu.<\/p>\n<pre>$sudo add-apt-repository ppa:pitti\/postgresql<\/pre>\n<p>3. After adding PPA, update your system\u00a0apt:<\/p>\n<pre>$sudo apt-get update<\/pre>\n<p>4.Finally install\u00a0<strong>postgresql-9.1<\/strong>:<\/p>\n<pre><strong>$sudo apt-get install postgresql<\/strong><\/pre>\n<p>if you having any error, make sure you already install\u00a0libpq-dev.The\u00a0<strong>libpq-dev<\/strong>\u00a0package is for compiling wrappers\/clients against libpq.<\/p>\n<pre>$sudo apt-get install postgresql-9.1 libpq-dev<\/pre>\n<p>5.Now check it out installation is successful or\u2026..<\/p>\n<pre>$ locate postgresql<\/pre>\n<p>6. If done!!!<\/p>\n<p>Check the install version.<\/p>\n<pre><strong><code>$psql -<\/code><code>V<\/code><\/strong><\/pre>\n<p>7.Now let\u2019s take look to postgres console<\/p>\n<pre>$su postgres<\/pre>\n<p>7(a) <b>Setup Root User \u2018posrgres\u2019<\/b><\/p>\n<pre>$sudo passwd postgres<\/pre>\n<p>give the postgres user a (unix) password,Now we can switch to the user postgres using command<\/p>\n<pre>$ su postgres<\/pre>\n<p>8. That\u2019s it for postgers installation. If you want to access postgres from remote, Mean localhost. You need to perform some addition setting to postgres conf file.<\/p>\n<p>First we edit the file postgresql.conf:<\/p>\n<pre><code>$ <strong>cd \/etc\/postgresql\/<\/strong><\/code><strong><code>9<\/code><code>.<\/code><code>1<\/code><code>\/main<\/code><\/strong><\/pre>\n<p>List all file in main folder<\/p>\n<pre>$ ls -la<\/pre>\n<p>total 80<br \/>\ndrwxr-xr-x 2 postgres postgres 4096 2012-05-17 18:05 .<br \/>\ndrwxr-xr-x 3 postgres postgres 4096 2012-04-07 12:44 ..<br \/>\n-rw-r\u2013r\u2013 1 postgres postgres 316 2012-04-07 12:44 environment<br \/>\n-rw-r\u2013r\u2013 1 postgres postgres 143 2012-04-07 12:44 pg_ctl.conf<br \/>\n-rw-r\u2014\u2013 1 postgres postgres 4653 2012-05-17 18:05 pg_hba.conf<br \/>\n-rw-r\u2014\u2013 1 postgres postgres 4649 2012-04-09 19:29 pg_hba.conf.bak.original<br \/>\n-rw-r\u2014\u2013 1 postgres postgres 1636 2012-04-07 12:44 pg_ident.conf<br \/>\n-rw-r\u2013r\u2013 1 postgres postgres 19235 2012-04-07 12:44 postgresql.conf<br \/>\n-rw-r\u2013r\u2013 1 postgres postgres 19235 2012-04-09 19:29 postgresql.conf.bak.original<br \/>\n-rw-r\u2013r\u2013 1 postgres postgres 378 2012-04-07 12:44 start.conf<\/p>\n<p>I have already back of config file, you need to make back up for further need<\/p>\n<pre>$ cp pg_hba.conf pg_hba.conf.bak.original\n$ cp postgresql.conf postgresql.conf.bak.original<\/pre>\n<p>9.\u00a0Make changes to\u00a0<strong>pg_hba.conf<\/strong> (authetification methods).<\/p>\n<pre>host    all         all       127.0.0.1\/32       <strong>trust<\/strong>          # md5 -&gt; trust<\/pre>\n<p>10.You make change in config file, So once restart you postgres<\/p>\n<pre>$sudo \/etc\/init.d\/postgresql restart\n*Restarting PostgreSQL 9.0 database server<\/pre>\n<div>That\u2019s it. Enjoy\u2026\u2026\u2026<\/div>\n","protected":false},"excerpt":{"rendered":"<p>PostgreSQL\u00a0is a powerful and reliable object-relational database system. It\u2019s a great alternative for MySQL. It is as easy to set up, performs better and offers&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-782","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts\/782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/comments?post=782"}],"version-history":[{"count":0,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts\/782\/revisions"}],"wp:attachment":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/media?parent=782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/categories?post=782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/tags?post=782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}