Videos / Other Resources

No attachments were found.

Install PostgreSQL with Linux

Overview:

How do I install PostgreSQL using Linux?

 Note: This FAQ is intended for Advanced PC Users Only!!!

 Special thanks to Schrapp from the Holdem Manager forums for this FAQ

 

 


Solution:

I'm assuming you already have a Linux box running on your local network. I used Debian. If you are using a different different distribution, you might have to change certain commands (for example, the packet manager your distribution uses, etc.).

Ok, let's get started.

1) INSTALL AND CONFIGURE POSTGRESQL

First, we want to become root by typing

Code:

$ su

 

 

Then we install postgresql. On Debian, I just typed:

Code:

# apt-get install postgresql

This will install postgresql to your machine. Use the appropriate packet manager for your distribution.


Then we add a new user by issuing the following commands:

Code:

# su postgres

$ createuser -P -s -R -d holdem

Enter password for new role: holdem

Enter it again: holdem

$ exit

This will create the user 'holdem' with password 'holdem'. Note that the password will not be displayed as you type it.


 

Next, we have to allow connections from other computers. Open /etc/postgresql/8.3/main/pg_hba.conf with your preferred editor (depending on your distribution this path may differ. In that case, issue 'updatedb && locate pg_hba.conf' to find the correct location) and append the following line:

Code:

host    all     all     192.168.0.0/24  md5

Of course, you have to change the subnet according to your local network. Make sure you save the changes you made to the file.


 

 

Next, open /etc/postgresql/8.3/main/postgresql.conf and find the line that reads as follows:

Code:

listen_addresses='localhost'

 

It might be commented out by default. If that is the case, uncomment it and change it like so:

Code:

listen_addresses='*'

 

Save the file and restart postgresql by issuing

Code:

# /etc/init.d/postgresql-8.3 restart

 

Again, the name of the init-script might differ. Find out the correct name by using auto complete (TAB).

That's it, we're done already. Let's test, if we can access the database. Open Holdem Manager and Select 'Options --> Database Management'. Change the Server Name to your server's IP address and Username/Password to 'holdem'. Then click connect. If you did everything right, you should be taken to the next screen where you can select existing databases (of course, there are none at this point) or create a new database. If you want to do the latter, go ahead. You can stop reading now.
If you want to copy your existing database from your Windows machine to the Linux server, keep on reading.

 

 


2) DUMPING AND RESTORING EXISTING DATABASES

Switch to your Windows machine and open the command line prompt. Type

Code:

cd "C:\Program Files\PostgreSQL\8.3\bin"

 

Again, change the path accordingly. Then issue the following command to dump all existing databases:

Code:

pg_dumpall.exe --username=postgres > holdem.dump

 

This may take some time. Now all databases should be dumped into the file holdem.dump.

Now let's restore the databases on the Linux box. Copy the file 'holdem.dump' to your Linux box and then issue

Code:

# su postgres

$ psql -f holdem.dump postgres

$ exit

 

Your databases have now been restored. Use Holdem Manager's Database Manager to connect to the Server again. This time, you should see all your databases. Make your current one the default and click Connect. Voila, you have successfully outsourced your Holdem Manager Database.

You can access the database server from as many machines as you want. You could even configure your firewall to forward port 5432, so that you could access the database away from home. I have not tested that myself though. Depending on your internet connection, you may get performance problems there.

Last but not least, I strongly recommend to put the database on a separate partition or Logical Volume, that is formatted with XFS and mounted with the option 'noatime'. This will greatly improve database performance. I will not explain this in detail, since it is beyond the scope of this tutorial. If you are interested in doing that and don't know how, just ask. I will then post more detailed instructions.

Ok, I hope this was useful to some people.

 

 

 

| More

Related Articles


User Opinions (20 votes)

100% thumbs up 0% thumbs down

How would you rate this answer?



Thank you for rating this answer.

Visitor Comments

No visitor comments posted. Post a comment

Post a comment

To post a comment for this article, simply complete the form below. Fields marked with an asterisk are required.
   Name:
   Email:
* Comment:
* Enter the code below:
 

Continue