293 | | |
| 293 | However, with postgres, you also need to specifically allow remote hosts to access the server. |
| 294 | |
| 295 | To begin with, you need to tell postgres to listen for connections from other hosts rather then just the localhost (the default). |
| 296 | |
| 297 | As the postgres user, edit postgresql.conf: |
| 298 | |
| 299 | {{{ |
| 300 | sudo vim /etc/postgresql/8.3/main/postgresql.conf |
| 301 | }}} |
| 302 | |
| 303 | Change: |
| 304 | |
| 305 | {{{ |
| 306 | #listen_addresses = ‘localhost’ |
| 307 | }}} |
| 308 | |
| 309 | to: |
| 310 | |
| 311 | {{{ |
| 312 | listen_addresses = ‘<ip address of oils server>’ |
| 313 | }}} |
| 314 | |
| 315 | Next, edit pg_hba.conf: |
| 316 | |
| 317 | {{{ |
| 318 | sudo vim /etc/postgresql/8.3/main/pg_hba.conf |
| 319 | }}} |
| 320 | |
| 321 | and in the area marked "Put your actual configuration here," enter the following: |
| 322 | |
| 323 | {{{ |
| 324 | # Put your actual configuration here |
| 325 | # ---------------------------------- |
| 326 | # |
| 327 | # If you want to allow non-local connections, you need to add more |
| 328 | # "host" records. In that case you will also need to make PostgreSQL listen |
| 329 | # on a non-local interface via the listen_addresses configuration parameter, |
| 330 | # or via the -i or -h command line switches. |
| 331 | # |
| 332 | |
| 333 | host evergreen evergreen 10.104.10.168/32 md5 |
| 334 | }}} |
| 335 | |
| 336 | ||connection type|| in this example, host is used. This means postgres should be looking for a TCP connection (rather then a Unix socket connection for example)|| |
| 337 | ||database||the name evergreen is being used in this example|| |
| 338 | ||user||again, in our hypothetical example, evergreen is the username|| |
| 339 | ||address||the ip address or host name of the machine that's allowed to make a connection. In real life, this would be the oils server address|| |
| 340 | ||authentication options||in this case md5 is used, meaning the password is encrypted|| |