Postgresql-config
From OpenSimulator
m (→First approach on Postgresql) |
m |
||
Line 12: | Line 12: | ||
Now we need to reset the password for the ‘postgres’ admin account for the server, so we can use this for all of the system administration tasks. Type the following at the command-line (substitute in the password you want to use for your administrator account): | Now we need to reset the password for the ‘postgres’ admin account for the server, so we can use this for all of the system administration tasks. Type the following at the command-line (substitute in the password you want to use for your administrator account): | ||
+ | <code> | ||
$ sudo su postgres -c psql template1 | $ sudo su postgres -c psql template1 | ||
template1=# ALTER USER postgres WITH PASSWORD 'password'; | template1=# ALTER USER postgres WITH PASSWORD 'password'; | ||
template1=# \q | template1=# \q | ||
+ | </code> | ||
That alters the password for within the database, now we need to do the same for the unix user ‘postgres’: | That alters the password for within the database, now we need to do the same for the unix user ‘postgres’: | ||
+ | <code> | ||
$ sudo passwd -d postgres | $ sudo passwd -d postgres | ||
$ sudo su postgres -c passwd | $ sudo su postgres -c passwd | ||
+ | </code> | ||
Now enter the same password that you used previously. | Now enter the same password that you used previously. | ||
Line 25: | Line 29: | ||
Finally, we need to open up the server so that we can access and use it remotely - unless you only want to access the database on the local machine. To do this, first, we need to edit the postgresql.conf file: | Finally, we need to open up the server so that we can access and use it remotely - unless you only want to access the database on the local machine. To do this, first, we need to edit the postgresql.conf file: | ||
+ | <code> | ||
$ sudo vi /etc/postgresql/8.2/main/postgresql.conf | $ sudo vi /etc/postgresql/8.2/main/postgresql.conf | ||
+ | </code> | ||
+ | |||
Now, to edit a couple of lines in the ‘Connections and Authentication’ section… | Now, to edit a couple of lines in the ‘Connections and Authentication’ section… | ||
Change the line: | Change the line: | ||
− | #listen_addresses = 'localhost' to listen_addresses = '*' | + | <code>#listen_addresses = 'localhost' to listen_addresses = '*'</code> |
and also change the line: | and also change the line: | ||
− | #password_encryption = on to password_encryption = on | + | <code>#password_encryption = on |
+ | to | ||
+ | password_encryption = on</code> | ||
Save the file. | Save the file. | ||
Line 40: | Line 49: | ||
That’s it, now all you have to do is restart the server: | That’s it, now all you have to do is restart the server: | ||
− | $ sudo /etc/init.d/postgresql-8.2 restart | + | <code>$ sudo /etc/init.d/postgresql-8.2 restart</code> |
And all should be working. | And all should be working. |
Revision as of 12:15, 10 February 2009
PostgreSQL configuration
I won't lie to you, setting up PostgreSQL on a Linux machine might look simple but it's a pain in the ass when you're not comfortable with using phpPgAdmin (kinda like phpMyadmin for MySQL)
Installation
If you are on a Linux machine, use your favorite package manager to get the Postgresql package from your distribution
Ubuntu/Debian: apt-get install postgresql
Now we need to reset the password for the ‘postgres’ admin account for the server, so we can use this for all of the system administration tasks. Type the following at the command-line (substitute in the password you want to use for your administrator account):
$ sudo su postgres -c psql template1
template1=# ALTER USER postgres WITH PASSWORD 'password';
template1=# \q
That alters the password for within the database, now we need to do the same for the unix user ‘postgres’:
$ sudo passwd -d postgres
$ sudo su postgres -c passwd
Now enter the same password that you used previously.
Finally, we need to open up the server so that we can access and use it remotely - unless you only want to access the database on the local machine. To do this, first, we need to edit the postgresql.conf file:
$ sudo vi /etc/postgresql/8.2/main/postgresql.conf
Now, to edit a couple of lines in the ‘Connections and Authentication’ section…
Change the line:
#listen_addresses = 'localhost' to listen_addresses = '*'
and also change the line:
#password_encryption = on
to
password_encryption = on
Save the file.
That’s it, now all you have to do is restart the server:
$ sudo /etc/init.d/postgresql-8.2 restart
And all should be working.