Install PostgreSQL on CentOS

53 %
47 %
Information about Install PostgreSQL on CentOS
Education

Published on February 23, 2014

Author: RangSang1

Source: slideshare.net

Description

How to install Postgresql 9.1 on CentOS 6.5. #

Installation Rangson Sangboonruang rangson.sng@gmail.com

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 Things to learn          Update repository Creating a user group of sudoers Putting sudogroup in sudoer file Installing Postgresql Starting Postgresql Server Editing configuration files Connecting from local computer Connecting from other computers Configuring the firewall

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 It is assumed that you already had CentOS Installed. Let’s log on to CentOS.

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 1 Updating repository - Download pgdg-redhat91-9.1-5.noarch.rpm from this urlo – http://yum.pgrpms.org/9.1/redhat/rhel-6-x86_64/pgdg-redhat91-9.1-5.noarch.rpm - Place the file in your preferred directory, e.g. /tmp. - Open Terminal window and go to /tmp. cd /tmp - List all the files in the directory to ensure that pgdgredhat91-9.1-5.noarch.rpm is already there. ls - The screen shall display something like the following.

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 - Try updating repository. rpm –Uvh pgdg-redhat91-9.1-5.noarch.rpm Explanation: You get this permission denied message because the user you are logging on is not a privileged user. You can log on using root but using root is not recommended because root is supper powerful and accidental damage can potentially happen using root to perform admin tasks. On CentOS you can use sudo to obtain supper user privilege and the command will be like the following. sudo rpm –Uvh pgdg-redhat91-9.1-5.noarch.rpm

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 Explanation: You get this message because the user you are using is not listed in sudoers file. It is recommended that you create a group called sudogroup (or anything you like) and add the user you are using to this group and put the whole group in sudoer file. To do all these, follow the following steps.

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 2 Creating a user group of sudoers - From the menu bar choose System>Administration>Users and Groups and you’ll be prompted to enter root’s password. - For those you are familiar with Linux command line, you can ignore this and perform the geek stuff.

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 - Now, you should see User Manager window. Click Add Group button and enter the group name then click OK.

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 - Add your current user to “sudogroup” by choosing “Users” tab, click Properties button (as highlighted). You should see User Properties window. In the list box scroll to the “sudogroup” and have it checked. Do not forget to specify the Primary Group as “sudogroup”.

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 3 Putting sudogroup in sudoer file - Go back to Terminal window and type the following command. su root Explanation: “su” is used to switch user from one to another. Now you are root. This is because to edit sudoer file you need root’s privilege. Next command is as followed. visudo

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 Explanation: The Terminal window is now a text editor called “vi”. go through these steps - Locate the cursor to the line that looks like “root ALL=(ALL) ALL”. - Press “i” on your keyboard insert text. - Put “$sudogroup ALL=(ALL) ALL” underneath. - Press “esc” on your keyboard then type :wq - Press “Enter” Explanation: You have just exited the vi editor and are ready to proceed the next step by typing the following command. sudo rpm –Uvh pgdg-redhat91-9.1-5.noarch.rpm Now

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 Explanation: After running the previous command you should receive the response like the above. - Run the following command to list all available Postgresql packages. yum list postgresql*

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 4 Installing Postgresql Explanation: Among all the listed packages the highlighted one is what we are about to use for our installation. - Type the following command sudo yum install postgresql91-server.x86_64

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 Explanation: After running yum install you should see the screen like the above and you’ll be prompted to say y (for yes) or n (for no) to proceed downloading the package and finish the installation. - Type y for now and wait until the screen displays “Complete!” Explanation: Now you have done with the installation. Next, let’s move on to the next slide.

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 5 Starting Postgresql Server - Type the following command. sudo service postgresql-9.1 start Starting the server FAILED because you need to initialize the database first. So let’s do it by typing the following command. sudo service postgresql-9.1 initdb

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 You are supposed to see the following screen. Now try starting the server again. see the following screen. This time you should

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 6 Editing configuration files - Type the following command to edit postgresql.conf sudo vi /var/lig/pgsql/9.1/data/posgresql.conf - Edit the file by changing these two lines: Uncomment Uncomment by removing #, and Change from ‘localhost’ to ‘*’

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 - Type the following command to edit pg_hba.conf sudo vi /var/lig/pgsql/9.1/data/pg_hba.conf - Edit the file by changing these two lines: Before After Insert new line Change from “indent” to “md5” The new line added contains the network address of you machine. computer to connect to your sever. This is to allow other

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 - Type the following command to restart the server. sudo service postgresql-9.1 restart - If successful you should see the following. - Type the following command to test your server. sudo su postgres createdb test psql test <<Successful screen>> Explanation: You should see this screen after running the command above. sudo su postgres => To switch to user postgres createdb test => To create a database called test psql test => To login to test database

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 7 Connecting from local computer - Type the following command to crate a role for the database. CREATE ROLE testuser WITH SUPERUSER LOGIN PASSWORD ‘test’; - Type the following command to exit test database q - Type the following command to test the connection to the server. psql -h localhost –U testuser test <<Successful screen>>

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 8 Connecting from other computers Explanation: I used pgAdmin III to connect to the Postgresql Server. And, first, failed to connect saying the server was not listening on port 5432. Of cause, there is something you have to do with the server.

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 9 Configuring the firewall (iptables) - Type the following command to exit test database q - Type the following command to exit from postgres exit <<Successful screen>>

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 - Type the following command to edit iptables sudo vi /etc/sysconfig/iptables Insert this line (before –A INPUT –j Reject….).

Installation of Postgresql on CentOS Postgresql Sever 9.1 and CentOS 6.5 - Type the following command to edit restart the firewall sudo service iptables restart <<Successful screen>> - Try connecting to the server from other computer again. This time you should be able to connect to the server.

Add a comment

Related presentations

Related pages

YUM Installation - PostgreSQL wiki

For example, to install PostgreSQL 9.4 on CentOS 6 64-bit: ... to install a basic PostgreSQL 9.4 server: yum install postgresql94-server
Read more

CentOS / RHEL Linux Install Postgresql Database Server

Q. How do I install and configure Postgresql database server under Red hat Enterprise Linux 5 / CentOS 5 / Fedora Linux? A. The postgresql ...
Read more

How To Install and Use PostgreSQL on a CentOS VPS ...

Before we install postgres, we must exclude the CentOS version of postgres in order to get the most recent version from the project's website.
Read more

PostgreSQL: Linux downloads (Red Hat family)

Linux downloads (Red Hat family) The Red Hat family of distributions includes Red Hat Enterprise Linux, CentOS, Fedora, Scientific Linux, Oracle Linux and ...
Read more

Install PostgreSQL 9.4.X on CentOS/RHEL 7/6/5 and Fedora

How to Install PostgreSQL 9.4 on CentOS/RHEL 7/6/5 and Fedora 21/20/19 Systems using yum package manager, Installing postgresql on linux based system.
Read more

Detailed installation guides - PostgreSQL wiki

RedHat/Fedora/CentOS . YUM Installation; PostgreSQL on RedHat Linux; ... Install PostgreSQL 9 on OS X ... Easy install using Homebrew package ...
Read more

Install PostgreSQL 9.3 on CentOS 7 - IT'zGeek - Linux ...

Install PosgreSQL 9.1.3: PostgreSQL publishes rpm packages for all Linux platforms, their packages are generally fresher than those in the other repository.
Read more

Install PostgreSQL 9 on CentOS : David Ghedini

Install PostgreSQL 9 on CentOS. This post will cover installing and basic configuration of PostgreSQL 9.x on CentOS. We will install PostgreSQL 9 using the ...
Read more

How to install PostgreSQL on Centos / Redhat/ | www ...

Hi All, In this article I want to quickly show you specific steps to install PostgreSQL 8 database on CENTOS Linux 5. As we all know that we can use yum to ...
Read more

Install & Launch PgAdmin on CentOS 6.2 with PostgreSQL 8.4.9

Next: From: Jean-Yves F. Barbier: Date: 2012-01-27 18:55:31: Subject: Re: Order of update triggers: Previous: From: Rob Richardson: Date: 2012-01-27 17:45:41
Read more