{"id":4175,"date":"2014-08-16T12:11:26","date_gmt":"2014-08-16T17:11:26","guid":{"rendered":"https:\/\/secure.rosehosting.com\/blog\/?p=4175"},"modified":"2022-12-12T08:47:30","modified_gmt":"2022-12-12T14:47:30","slug":"how-to-install-postgresql-on-a-centos-6-vps","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/","title":{"rendered":"How to install PostgreSQL on CentOS 6"},"content":{"rendered":"
<\/div>

\"postgresql\"Today we will show you how to install PostgreSQL<\/strong> on a CentOS 6 VPS<\/a>. PostgreSQL is a cross-platform object-relational database management system and its primary function is to store data and retrieve it later. It is open source and it is designed for high volume environments.<\/p>\n

Current stable release of PostgreSQL is 9.3 and it is community supported until 2018-09-09.<\/p>\n

The installation of PostgreSQL is very simple and requires only few minutes to be completed. Let’s start.<\/p>\n

<\/p>\n

First thing you need to do is to exclude the\u00a0PostgreSQL in your \/etc\/yum.repos.d\/CentOS-Base.repo<\/span>. You need to add the following line<\/p>\n

exclude=postgresql*<\/pre>\n

in the [base] and [updates] sections and save the changes.<\/p>\n

Next, you need to install the PGDG RPM file by using the commands:<\/p>\n

For 32bit CentOS systems:<\/p>\n

## yum localinstall http:\/\/yum.postgresql.org\/9.3\/redhat\/rhel-6-i386\/pgdg-centos93-9.3-1.noarch.rpm<\/pre>\n

For 64bit CentOS systems:<\/p>\n

## yum localinstall http:\/\/yum.postgresql.org\/9.3\/redhat\/rhel-6-x86_64\/pgdg-centos93-9.3-1.noarch.rpm<\/pre>\n

If you like to list the available packages you can use the command:<\/p>\n

## yum list postgres*<\/pre>\n

To install a basic PostgreSQL 9.3 server use the following command:<\/p>\n

## yum install postgresql93-server<\/pre>\n

Once the postgresql93-server package is installed, you need to initialize a database:<\/p>\n

## service postgresql-9.3 initdb<\/pre>\n

If you like to\u00a0enable PostgreSQL on system startup you can type:<\/p>\n

## chkconfig postgresql-9.3 on<\/pre>\n

And finally, use the following command to start the database service:<\/p>\n

## service postgresql-9.3 start<\/pre>\n

Once the installation is completed, you can start using the PostgreSQL 9.3<\/strong> on your CentOS 6 VPS<\/a> by typing the commands:<\/p>\n

## su - postgres\r\n## psql<\/pre>\n

If you don’t know what to do next, you can always use the help command which will tell you exactly how to use the PostgreSQL command line interface.<\/p>\n

The easiest way to start using PostgreSQL is to create a schema in the database called postgres, which is default.<\/p>\n

## CREATE SCHEMA newschema;<\/pre>\n

Next, create new user and set a password for that user<\/p>\n

## CREATE USER newuser PASSWORD 'yourpassword';<\/pre>\n

Grant privileges with<\/p>\n

## GRANT ALL ON SCHEMA newschema TO newuser;\r\n## GRANT ALL ON ALL TABLES IN SCHEMA newschema TO newuser;<\/pre>\n

And finally exit PostgreSQL using the command<\/p>\n

## \\q<\/pre>\n

Now, you can\u00a0log in using the\u00a0newuser with<\/p>\n

## su - newuser<\/pre>\n

Please note, the default authentication mode is set to ‘ident’, so if you like to log in as newuser, you should register the newuser as a Linux system user on your CentOS 6 VPS<\/a>.<\/p>\n

Of course you don\u2019t have to do any of this if you use one of our Linux VPS hosting services<\/a>, in which case you can simply ask our expert Linux admins to do this for you. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n

PS<\/span>.<\/strong> If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"

Today we will show you how to install PostgreSQL on a CentOS 6 VPS. PostgreSQL is a cross-platform object-relational database … <\/p>\n

Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":4176,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1699,1702,13],"tags":[34,528,434],"yoast_head":"\nHow to install PostgreSQL on CentOS 6 - RoseHosting<\/title>\n<meta name=\"description\" content=\"How to install PostgreSQL on CentOS 6 - RoseHosting\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to install PostgreSQL on CentOS 6 - RoseHosting\" \/>\n<meta property=\"og:description\" content=\"How to install PostgreSQL on CentOS 6 - RoseHosting\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2014-08-16T17:11:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-12T14:47:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/postgresql.png\" \/>\n\t<meta property=\"og:image:width\" content=\"252\" \/>\n\t<meta property=\"og:image:height\" content=\"280\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"How to install PostgreSQL on CentOS 6\",\"datePublished\":\"2014-08-16T17:11:26+00:00\",\"dateModified\":\"2022-12-12T14:47:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/\"},\"wordCount\":405,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/postgresql.png\",\"keywords\":[\"centos\",\"install PostgreSQL on CentOS\",\"PostgreSQL\"],\"articleSection\":[\"CentOS\",\"Databases\",\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/\",\"name\":\"How to install PostgreSQL on CentOS 6 - RoseHosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/postgresql.png\",\"datePublished\":\"2014-08-16T17:11:26+00:00\",\"dateModified\":\"2022-12-12T14:47:30+00:00\",\"description\":\"How to install PostgreSQL on CentOS 6 - RoseHosting\",\"breadcrumb\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/#primaryimage\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/postgresql.png\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/postgresql.png\",\"width\":252,\"height\":280,\"caption\":\"postgresql\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.rosehosting.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to install PostgreSQL on CentOS 6\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"name\":\"RoseHosting\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/RoseHosting\",\"https:\/\/x.com\/rosehosting\",\"https:\/\/www.linkedin.com\/in\/rosehosting\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\/\/www.rosehosting.com\",\"https:\/\/www.facebook.com\/rosehosting.helpdesk\"],\"url\":\"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to install PostgreSQL on CentOS 6 - RoseHosting","description":"How to install PostgreSQL on CentOS 6 - RoseHosting","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/","og_locale":"en_US","og_type":"article","og_title":"How to install PostgreSQL on CentOS 6 - RoseHosting","og_description":"How to install PostgreSQL on CentOS 6 - RoseHosting","og_url":"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2014-08-16T17:11:26+00:00","article_modified_time":"2022-12-12T14:47:30+00:00","og_image":[{"width":252,"height":280,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/postgresql.png","type":"image\/png"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"How to install PostgreSQL on CentOS 6","datePublished":"2014-08-16T17:11:26+00:00","dateModified":"2022-12-12T14:47:30+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/"},"wordCount":405,"commentCount":0,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/postgresql.png","keywords":["centos","install PostgreSQL on CentOS","PostgreSQL"],"articleSection":["CentOS","Databases","Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/","url":"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/","name":"How to install PostgreSQL on CentOS 6 - RoseHosting","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/postgresql.png","datePublished":"2014-08-16T17:11:26+00:00","dateModified":"2022-12-12T14:47:30+00:00","description":"How to install PostgreSQL on CentOS 6 - RoseHosting","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/postgresql.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/postgresql.png","width":252,"height":280,"caption":"postgresql"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-postgresql-on-a-centos-6-vps\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to install PostgreSQL on CentOS 6"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"]},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/4175"}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=4175"}],"version-history":[{"count":3,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/4175\/revisions"}],"predecessor-version":[{"id":44170,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/4175\/revisions\/44170"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/4176"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=4175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=4175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=4175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}