This how to will guide you on installing PostgreSQL 8.1.5 on DirectAdmin
There are two ways to install it:
1). You can install postgresql with yum, however you may not have the latest version installed.
# yum -y install postgresql postgresql-server
2). Alternatively, download the rpms from http://www.postgresql.org/ftp/binary/v8.1.5/linux/rpms/ according to your Operating System distro.
The following are required:
postgresql-libs-8.1.5-3PGDG.i686.rpm
postgresql-8.1.5-3PGDG.i686.rpm
postgresql-server-8.1.5-3PGDG.i686.rpm
postgresql-devel-8.1.5-3PGDG.i686.rpm
(choose rhel-es-4 if your are using CentOS)
Right click on the mirror link and press “T” to copy the url
# wget paste_the_url_here
# wget paste_the_url_here
# wget paste_the_url_here
# wget paste_the_url_here
Install the rpms:
# rpm -ivh postgresql-libs-8.1.5-3PGDG.i686.rpm
# rpm -ivh postgresql-8.1.5-3PGDG.i686.rpm
# rpm -ivh postgresql-server-8.1.5-3PGDG.i686.rpm
# rpm -ivh postgresql-devel-8.1.5-3PGDG.i686.rpm
You have now installed PostgreSQL on your server. The installation is pretty easy. Now we should modify some settings:
# nano -w /var/lib/pgsql/data/pg_hba.conf
If you got these two lines:
host all all 127.0.0.1/32 ident sameuser
host all all ::1/128 ident sameuser
Change them to:
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
And the following line to the end of the file:
host all all 0.0.0.0 255.255.255.255 reject
so the pg_hba.conf will look like:
local all all ident sameuser
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
host all all 0.0.0.0 255.255.255.255 reject
Start PostgreSQL Server now:
# service postgresql start
Now you need to create a “super user“, like a root account for pgsql that has full privileges.
# su postgres
createuser -P -U postgres da_admin
This command will initiate an user creation script.
Enter password for user ¡§da_admin¡¨:
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
The CREATE USER statement indicates that the command was successful.
Restart postgresql:
# service postgresql restart
We then need to re-compile php with pgsql support.
# cd /usr/local/directadmin/customapache
# nano -w configure.php
add:
--with-pgsql=/var/lib/pgsql \
after:
--with-mysql=/usr \
Save and exit, then type:
# ./build php n
at last restart apache:
#service httpd restart
Now test with the following php code:
<?php
$password="password";
$con=pg_connect("host=localhost dbname=template1 user=da_admin password=$password");
?>
If you dont see any error message, congratualtions you make it ![]()
Print This Post
Blogsphere: TechnoratiFeedsterBloglines
Bookmark: Del.icio.usSpurlFurlSimpyBlinkDigg
RSS feed for comments on this post | TrackBack URI for this post
Related Post:
- Howto Install phpPgAdmin on DirectAdmin
- Howto Install LxAdmin
- Add a ‘Change Password’ button to SquirrelMail
- Script for phpMyAdmin Update
- Howto Install Zend Optimizer on cPanel/WHM

[...] First, make sure you have install PostgreSQL on your DirectAdmin, or you can install it using this howto. [...]