欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

postgresql install and configure for ubuntu

程序员文章站 2022-07-15 11:46:44
...

ABSTRACT

PostgreSQL is an object-relational database system that has the features of traditional commercial database systems with enhancements to be found in next-generation DBMS systems. This blog entry documents the installation process of the PostgreSQL database on Ubuntu Linux.

 

 

sudo apt-get install postgresql
sudo apt-get install libpq-dev

INTRODUCTION

I have selected PostgreSQL 9.1 and Ubuntu Linux 12.10 32 bit. The installation process follows the apt-get install configure pattern.

STEP 1: VERIFY THAT YOU DO NOT ALREADY HAVE POSTGRESQL INSTALLED ON YOUR SYSTEM

Run the following command in your console:

1
ps ax | grep postgres

If you get a response similar to the one below, then you have PostgreSQL installed.

1
2
3
4
Ss 0:00 postgres: writer process
Ss 0:00 postgres: wal writer process
Ss 0:00 postgres: autovacuum launcher process
Ss 0:00 postgres: stats collector process

STEP 2: INSTALL POSTGRESQL ON YOUR SYSTEM

Run the following commands in your console:

1
2
sudo apt-get update
sudo apt-get install postgresql-9.1

STEP 3: CONFIGURE YOUR POSTGRESQL PASSWORD

1
2
3
sudo -u postgres psql template1
ALTER USER postgres with encrypted password 'your_password';
Press ctrl-d

STEP 4: CONFIGURE MD5 AUTHENTICATION

1
sudo nano /etc/postgresql/9.1/main/pg_hba.conf

Update the

1
local all postgres

entry to

1
local all postgres md5

STEP 5: ENABLE TCP/IP CONNECTIONS

1
sudo nano /etc/postgresql/9.1/main/postgresql.conf

Locate the line

1
#listen_addresses = 'localhost'

and change it to:

1
listen_addresses = 'localhost'

To allow other computers to connect to your PostgreSQL server replace ‘localhost’ with the IP Address of your server, or alternatively to ’0.0.0.0′ to bind to all interfaces.

STEP 6: RESTART POSTGRES

1
sudo service postgresql restart

STEP 7: CONGRATULATIONS! YOU HAVE SUCCESSIVELY INSTALLED POSTGRESQL ON UBUNTU

相关标签: postgresql ubuntu