pgsql – TecAdmin https://tecadmin.net How to guide for System Administrator's and Developers Mon, 24 Oct 2022 05:46:42 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 How to Install PostgreSQL 11 on Debian 8 (Jessie) https://tecadmin.net/install-postgresql-on-debian/ https://tecadmin.net/install-postgresql-on-debian/#comments Sat, 11 Feb 2017 04:56:31 +0000 https://tecadmin.net/?p=11191 PostgreSQL is an open source object-relational database system. It is one of leading database server used for production servers. This tutorial will help you to install the PostgreSQL database server on Debian 8 Jessie systems. How to Install PostgreSQL on Ubuntu Step 1 – Prerequsities First, you need to import PostgreSQL packages signing key on [...]

The post How to Install PostgreSQL 11 on Debian 8 (Jessie) appeared first on TecAdmin.

]]>
PostgreSQL is an open source object-relational database system. It is one of leading database server used for production servers. This tutorial will help you to install the PostgreSQL database server on Debian 8 Jessie systems.

Step 1 – Prerequsities

First, you need to import PostgreSQL packages signing key on your system. Use the below command to import the key.

wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -

Now add PostgreSQL apt repository in your system as per your operating system. These are suggested on official PostgreSQL website using following command.

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'

Step 2 – Install PostgreSQL on Debian 8

At this stage, you have successfully added PostgreSQL official repository in your system. Now update the repository list. After that install Latest PostgreSQL Server in our Ubuntu system using following commands.

sudo apt-get update
sudo apt-get install postgresql postgresql-contrib

Step 3 – Connect to PostgreSQL

After installing the PostgreSQL database server by default, it creates a user ‘postgres’ with role ‘postgres’. It also creates a system account with the same name ‘postgres’. So to connect to postgres server, login to your system as user postgres and connect database.

sudo su - postgres
psql

Now you are logged in to PostgreSQL database server. To check login info use following command from database command prompt.

postgres-# \conninfo

To disconnect from PostgreSQL database command prompt just type below command and press enter. It will return you back to Debian command prompt.

postgres-# \q

Your PostgreSQL installation has been completed successfully. Let’s move to phpPgAdmin installation of Ubuntu systems.

The post How to Install PostgreSQL 11 on Debian 8 (Jessie) appeared first on TecAdmin.

]]>
https://tecadmin.net/install-postgresql-on-debian/feed/ 8
How to Install PostgreSQL 9.6 on CentOS/RHEL 7 https://tecadmin.net/install-postgresql-on-centos-rhel-and-fedora/ https://tecadmin.net/install-postgresql-on-centos-rhel-and-fedora/#comments Sat, 10 Jan 2015 03:43:47 +0000 https://tecadmin.net/?p=2985 PostgreSQL is an open source object-relational, highly scalable, SQL compliant database management system. PostgreSQL is developed at the University of California at Berkeley Computer Science Department. This article will help you for installing PostgreSQL on CentOS, RHEL and Fedora Systems. Adding PostgreSQL Yum Repository The first step is to install PostgreSQL repository in your system, [...]

The post How to Install PostgreSQL 9.6 on CentOS/RHEL 7 appeared first on TecAdmin.

]]>
PostgreSQL is an open source object-relational, highly scalable, SQL compliant database management system. PostgreSQL is developed at the University of California at Berkeley Computer Science Department. This article will help you for installing PostgreSQL on CentOS, RHEL and Fedora Systems.

Adding PostgreSQL Yum Repository

The first step is to install PostgreSQL repository in your system, Use one of below commands as per your system architecture and operating system.

### CentOS/RHEL 7 ###
rpm -Uvh http://yum.postgresql.org/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm

### CentOS/RHEL 6 ###
rpm -Uvh http://yum.postgresql.org/9.6/redhat/rhel-6-x86_64/pgdg-redhat96-9.6-3.noarch.rpm


### Fedora 26 ###
rpm -Uvh http://yum.postgresql.org/9.6/fedora/fedora-26-x86_64/pgdg-fedora96-9.6-3.noarch.rpm

### Fedora 25 ###
rpm -Uvh http://yum.postgresql.org/9.6/fedora/fedora-25-x86_64/pgdg-fedora96-9.6-3.noarch.rpm

### Fedora 24 ###
rpm -Uvh http://yum.postgresql.org/9.6/fedora/fedora-25-x86_64/pgdg-fedora96-9.6-3.noarch.rpm

For more details visit PostgreSQL repositories link page where you can get repository package rpm for various operating systems.

Installing PostgreSQL Server

After enabling PostgreSQL yum repository in your system use following command to install PostgreSQL 9.6 on your system with yum package manager.

yum install postgresql96-server postgresql96
Initializing PGDATA

After installing PostgreSQL server, It’s required to initialize it before using the first time. To initialize database use below command.

/usr/pgsql-9.6/bin/postgresql96-setup initdb

Above command will take some time to initialize PostgreSQL first time. PGDATA environment variable contains the path of the data directory.

PostgreSQL data directory Path: /var/lib/pgsql/9./data/

Start PostgreSQL Server

To start PostgreSQL service using the following command as per your operating systems. Also, enable PostgreSQL service to autostart on system boot.

For CentOS/RHEL 7 and Fedora

systemctl start postgresql-9.6
systemctl enable postgresql-9.6

For CentOS/RHEL 6

service  postgresql-9.6 start
chkconfig postgresql-9.6 on
Verify PostgreSQL Installation

After completing above steps, you have installed PostgreSQL 9.6 on your server, Let’s log in to postfix to verify that installation completed successfully.

su - postgres

Use psql command to access PostgreSQL prompt with admin privileges.

 psql


psql (9.6.6)
Type "help" for help.

postgres=#

You may create password for user postgres for security purpose.

postgres=# password postgres

Congratulation’s! You have successfully installed PostgreSQL Server. Read below article to install phpPgAdmin.

How to Install phpPgAdmin on CentOS using Yum

Thanks for using this tutorial for installing PostgreSQL 9.6 on CentOS/RHEL 7/6 and Fedora 26/25/24 systems

The post How to Install PostgreSQL 9.6 on CentOS/RHEL 7 appeared first on TecAdmin.

]]>
https://tecadmin.net/install-postgresql-on-centos-rhel-and-fedora/feed/ 5
Installing PostgreSQL 9.1 on CentOS 5/6 and RHEL 5/6 https://tecadmin.net/installing-postgresql-9-1-on-centos-56-and-rhel-56/ https://tecadmin.net/installing-postgresql-9-1-on-centos-56-and-rhel-56/#comments Mon, 08 Apr 2013 09:31:56 +0000 https://tecadmin.net/?p=827 PostgreSQL is a open source object-relational, highly scalable, SQL compliant database management system. This article will help you for installing PostgreSQL 9.1 on CentOS 5/6 and RHEL 5/6. Step 1: Add PostgreSQL Yum Repository First step is to install postgres repository in your system, Use one of below commands as per your system architecture and [...]

The post Installing PostgreSQL 9.1 on CentOS 5/6 and RHEL 5/6 appeared first on TecAdmin.

]]>
PostgreSQL is a open source object-relational, highly scalable, SQL compliant database management system. This article will help you for installing PostgreSQL 9.1 on CentOS 5/6 and RHEL 5/6.

Step 1: Add PostgreSQL Yum Repository

First step is to install postgres repository in your system, Use one of below commands as per your system architecture and operating system.

CentOS/RHEL 5, 32-Bit:
#  rpm -Uvh http://yum.postgresql.org/9.1/redhat/rhel-5-i386/pgdg-centos91-9.1-4.noarch.rpm

CentOS/RHEL 6, 32-Bit:
#  rpm -Uvh http://yum.postgresql.org/9.1/redhat/rhel-6-i386/pgdg-centos91-9.1-4.noarch.rpm

CentOS/RHEL 5, 64-Bit:
#  rpm -Uvh http://yum.postgresql.org/9.1/redhat/rhel-5.0-x86_64//pgdg-centos91-9.1-4.noarch.rpm

CentOS/RHEL 6, 64-Bit:
#  rpm -Uvh http://yum.postgresql.org/9.1/redhat/rhel-6.3-x86_64/pgdg-centos91-9.1-4.noarch.rpm
Step 2: Install PostgreSQL Server 9.1 using Yum.

Below command will install PostgreSQL 9.1 on your system.

# yum install postgresql91-server

Sample Output

Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: ftp.iitm.ac.in
 * epel: mirror.yourconnect.com
 * extras: ftp.iitm.ac.in
 * updates: ftp.iitm.ac.in
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package postgresql91-server.i686 0:9.1.9-1PGDG.rhel6 will be installed
--> Processing Dependency: postgresql91 = 9.1.9-1PGDG.rhel6 for package: postgresql91-server-9.1.9-1PGDG.rhel6.i686
--> Processing Dependency: libpq.so.5 for package: postgresql91-server-9.1.9-1PGDG.rhel6.i686
--> Running transaction check
---> Package postgresql91.i686 0:9.1.9-1PGDG.rhel6 will be installed
---> Package postgresql91-libs.i686 0:9.1.9-1PGDG.rhel6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                       Arch           Version                        Repository        Size
====================================================================================================
Installing:
 postgresql91-server           i686           9.1.9-1PGDG.rhel6              pgdg91           3.6 M
Installing for dependencies:
 postgresql91                  i686           9.1.9-1PGDG.rhel6              pgdg91           973 k
 postgresql91-libs             i686           9.1.9-1PGDG.rhel6              pgdg91           192 k

Transaction Summary
====================================================================================================
Install       3 Package(s)

Total download size: 4.7 M
Installed size: 20 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): postgresql91-9.1.9-1PGDG.rhel6.i686.rpm                               | 973 kB     00:02
(2/3): postgresql91-libs-9.1.9-1PGDG.rhel6.i686.rpm                          | 192 kB     00:02
(3/3): postgresql91-server-9.1.9-1PGDG.rhel6.i686.rpm                        | 3.6 MB     00:07
----------------------------------------------------------------------------------------------------
Total                                                               321 kB/s | 4.7 MB     00:15
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : postgresql91-libs-9.1.9-1PGDG.rhel6.i686                                         1/3
  Installing : postgresql91-9.1.9-1PGDG.rhel6.i686                                              2/3
  Installing : postgresql91-server-9.1.9-1PGDG.rhel6.i686                                       3/3

Installed:
  postgresql91-server.i686 0:9.1.9-1PGDG.rhel6

Dependency Installed:
  postgresql91.i686 0:9.1.9-1PGDG.rhel6          postgresql91-libs.i686 0:9.1.9-1PGDG.rhel6

Complete!
Step 3: Initialize PGDATA first time after Installation

After installing PosgreSQL server, Its required to initialize it before using first time. To initialize database use below command.

# /etc/init.d/postgresql-9.1 initdb

Above command will take some time to initialize postgres first time. PGDATA environment variable contains path of data directory.

PostgreSQL data directory Path

/var/lib/pgsql/9.1/data/

Older version ( PostgreSQL 7 or 8 ) uses below path by default for data directory.

/var/lib/pgsql/data/
Step 4: Start PostgreSQL Server

Start postgresql service using following command.

# service postgresql-9.1 start

Setup PostgreSQL service to auto start on system boot.

# chkconfig postgresql-9.1 on
Step 5: Access PostgreSQL admin command prompt.

To access postgres as admin user, first switch to postgres system account.

# su - postgres

Use psql command to access postgres prompt with admin priviledges.

$ psql

Sample output:

psql (9.1.9)
Type "help" for help.

postgres=#

Read below article to to how to install phpPgAdmin.

>> How to Install phpPgAdmin on CentOS using Yum

Thanks for using this tutorial for installting PostgreSQL 9.1 on CentOS 5/6 and RHEL 5/6 systems.

The post Installing PostgreSQL 9.1 on CentOS 5/6 and RHEL 5/6 appeared first on TecAdmin.

]]>
https://tecadmin.net/installing-postgresql-9-1-on-centos-56-and-rhel-56/feed/ 1