HOWTO Install PostgreSQL

From EnGardeWiki

Jump to: navigation, search

I'm not sure which should be performed first. I added the "postgresql-server" package then created the postgres user through the "Users and Groups" module.

This HowTo does included steps to enable network access. Feel free to adjust as you see fit.

Remember, any extra packages you install will be upgraded by the WebTool GDSN module automatically, and you must have the GDSN configured before you can perform the steps in this document.

Contents

Notes

  • PostgreSQL does work inside enforced selinux.

Initial Steps

First in a web browser connect and log in to the WebTool:

https://yourIPaddress:1023/

In WebTool go to:

 Click the System menu -> choose Guardian Digital Secure Network -> then click the Package Managment 
 from the Modules menu. 

Now you should see a List of Extra Packages:

 To install PostgreSQL check the box for "postgresql-server".

Now go to user administration:

 Click the System menu -> choose Users and Groups -> then click Create User from the Modules menu.

Fill out the user information:

 Username = postgres
 Full Name = PostgreSQL Administration User
 Password = remember_your_password
 Verify Password = remember_your_password
 Shell Access = yes
 Group = Users
 
 Click Create User 

Using The Shell As Sysadm Role

Begin by ensuring your id is in the admin group. Next login to your machine as root and changing to the sysadm_r role (if you're not already in this role) and disabling SELinux:

# newrole -r sysadm_r
# setenforce 0

Run the startup script to initialize the database and start postgresql server processes

 /etc/init.d/postgresql start

Using The Shell As "postgres"

After the previous steps are completed. Edit /var/lib/pgsql/data/pg_hba.conf to allow your workstation to access this postgresql instance.

 # Example entry to allow 192.168.0.100 to access postgres remotely with an encrypted password
 host  all  all  192.168.0.100/32 md5

Next, edit /var/lib/pgsql/data/postgres.conf and replace example 1 with example 2.

 # Example 1 - the original entry
 #listen_addresses = 'localhost'       # what IP address(es) to listen on;
                                       # comma-separated list of addresses;
                                       # defaults to 'localhost', '*' = all
 #port = 5432
 # Example 2 - the new entry
 listen_addresses = 'all'       # what IP address(es) to listen on;
                                       # comma-separated list of addresses;
                                       # defaults to 'localhost', '*' = all
 port = 5432

Next, run the following SQL statement to setup the postgres database user with an encrypted password.

 ALTER USER postgres WITH ENCRYPTED PASSWORD 'remember_your_password';

Finally, bounce postgresql...

 /etc/init.d/postgresql restart

This will leave your postgresql service enabled and running with you able to login remotely with a non-ssl connection.

Using pgadmin

Personally, I'm a huge fan of pgadmin. It has all the goodies. Good luck, and have fun.

-prpht9

Unsure What Goes Here Yet

Explanation here.

External Links

Here are some external links to PostgreSQL.

Personal tools