1. Installed Mandrake 10 for max compatibility, ease of porting apps from desktop. Also make user sgh.
2. Installed apache2, mod-php, php-mysql, php-pgsql, phppgadmin
3. Had to make the sgh user and db. Struggled a bit, finally saw the README.mdk in /usr/share/doc/postgresql-server-7.4.1/ -
After you installed the packages, here is the procedure toThis will fail, saying FATAL sgh database does not exist. You have do do an extra step before step 6 - run
start quickly but nicely.
1- Become root user on your machine. (su)
2- Become postgres user. (su postgres)
3- Create a user (createuser)
4- Be sure that the postmaster is running (service postgresql status)
5- Logout from the postgres and the root account.
6- Test it. (psql -U [username])
createdbas user sgh.
Directly trying to run phppgadmin fails. This is because the default install of postgres will not allow connects on port 5432 - it allows only connects with the local UNIX sockets. So, psql will work, phppgadmin will not, till you modify the pg_hba.conf in /var/lib/pgsql/ -
# TYPE DATABASE USER IP-ADDRESS IP-MASK METHODand also pg_hba.conf says,
local all all ident sameuser
host all all 127.0.0.1 255.255.255.255 trust
#Also, remember TCP/IP connections are only enabled
# if you enable "tcpip_socket" in postgresql.conf
So, accordingly, changed false to true: tcpip_socket = true in postgresql.conf and did
service postgresql restartVoila! netstat -a shows
tcp 0 0 *:postgres *:* LISTEN
Now phppgadmin works. Agreed that this is not suitable for multi-user systems... (the trust all users part). Changing to md5 instead of trust, restarted postgresql, instantly stopped stuff from working. Problem was that the password had not been set. Easiest way - first enable the trust connection, then in phppgadmin, User Admin in the system tables - edit the sgh user, add the appropriate password, and now the md5 authentication works. Otherwise, while creating the user, createuser -P will prompt for the new user's password.
OK, how about inserting the existing database from the database dump? For a refresher, the commands were
pg_dump sgh > sghdbdump.txtBut it gave an error,
psql -d sgh -f sghdbdump.txt
language "plpgsql" does not exist
HINT: You need to use "createlang" to load the language into the database.
And createlang plpgsql says
createlang: language installation failed: ERROR: could not access file "$libdir/plpgsql": No such file or directory. Checking out locate plpgsql and whereis plpgsql did not find it. So, will consult PB and Google on installing it.
No comments:
Post a Comment