To get PhpPgAdmin working you need three things: Postgres (of course), Php, and a webserver. Postgres, I already had installed and working following this tutorial. Rather than emerging the default Postgres package which is version 8.2, I emerged the latest package 8.3. So:
emerge -av virtual/postgresql-base #emerge the database
passwd postgres #set a password for the db user
New UNIX password:
Retype new UNIX password:
passwd: password updated successfully
emerge --config =postgresql-8.3.5 #(now 8.3.7), finish the install
/etc/init.d/postgresql start #start the database
rc-update add postgresql default #and, of course, add to the default runlevel
You can then configure the users to your hearts content using the
createuserand
dropusercommands. In addition, make sure to edit pg_hba.conf to allow all the connections you need. Make sure local, unix socket, connections are available. Is should be available under
/var/lib/postgresql/8.3/data/pg_hba.conf.Also, make sure any users that will need to locally access the database are in the Postgres group.
usermod -aG postgres username
Keep in mind that whatever user your webserver runs as will also need to be added.
Which, brings us to the next step: the webserver. For reasons unreleated to PhpPgAdmin I already had an install of Lighttpd, and I wanted to use it rather than the standard Apache2. After fiddling for a while I reallized that I would have to reemerge it with the fastcgi and php flags enables (they are not enabled by default.) So:
echo "www-servers/lighttpd fastcgi php" >> /etc/portage/package.use #enable flags
emerge -av lighttpd #emerge lighttpd
/etc/init.d/lighttpd start #start the server
rc-update add lighttpd default #make sure it starts on restart
Php is a straightforward install:
echo "dev-lang/php cgi" >> /etc/portage/package.use
emerge -av php
You may wany to set
cgi.fix_pathinfoto 1 in
php.info:
vim /etc/php/cgi-php/php.ini
Before you install PhpPgAdmin, change
vhost_serverto whatever webserver you installed. It defaults to Apache, so if you used Lighttpd, change it to that. This file is
/etc/vhosts/webapp-config/. And we can install PhpPgAdmin:
emerge -av phppgadmin
That should be it. You can access it through
http://your.domain.com/phppgadminusing whatever login you made for Postgres.
No comments:
Post a Comment