{"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":"
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 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 For 64bit CentOS systems:<\/p>\n If you like to list the available packages you can use the command:<\/p>\n To install a basic PostgreSQL 9.3 server use the following command:<\/p>\n Once the postgresql93-server package is installed, you need to initialize a database:<\/p>\n If you like to\u00a0enable PostgreSQL on system startup you can type:<\/p>\n And finally, use the following command to start the database service:<\/p>\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 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 Next, create new user and set a password for that user<\/p>\n Grant privileges with<\/p>\n And finally exit PostgreSQL using the command<\/p>\n Now, you can\u00a0log in using the\u00a0newuser with<\/p>\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>\nexclude=postgresql*<\/pre>\n
## yum localinstall http:\/\/yum.postgresql.org\/9.3\/redhat\/rhel-6-i386\/pgdg-centos93-9.3-1.noarch.rpm<\/pre>\n
## yum localinstall http:\/\/yum.postgresql.org\/9.3\/redhat\/rhel-6-x86_64\/pgdg-centos93-9.3-1.noarch.rpm<\/pre>\n
## yum list postgres*<\/pre>\n
## yum install postgresql93-server<\/pre>\n
## service postgresql-9.3 initdb<\/pre>\n
## chkconfig postgresql-9.3 on<\/pre>\n
## service postgresql-9.3 start<\/pre>\n
## su - postgres\r\n## psql<\/pre>\n
## CREATE SCHEMA newschema;<\/pre>\n
## CREATE USER newuser PASSWORD 'yourpassword';<\/pre>\n
## GRANT ALL ON SCHEMA newschema TO newuser;\r\n## GRANT ALL ON ALL TABLES IN SCHEMA newschema TO newuser;<\/pre>\n
## \\q<\/pre>\n
## su - newuser<\/pre>\n