snicknet.net

‘Keepin it White n Nerdy’

Apr-8-2009

More Classes and PostgreSQL

I learned yesterday that I had been mis-informed as to how many courses remained before I could graduate. It turns out that I need one more project course. I was lucky, I guess I’ll use that word, enough to have a course that fit my schedule. I am now once again taking 20 units over 5 classes, two of which are project courses. My nice 16 hour work week has now gone down to a tentative 8 hours at opposite ends of the week. So much for income this last quarter. The course I added was the database projects course. I figured having worked with databases for a while I could breeze through this class for the most part. What I hadn’t counted on was the enormity of these projects. As someone who has worked with databases these things are time consuming. The first part of the 5 part project is due next week, so I have already been cut short by a week. To add to the pressure I have 2 other large projects due next week along with 2 homework assignments. It’s not going to be a very good week. On another note this database course will be using PostgreSQL which I have not worked with before. What I have gathered so far is that it is a royal pain to setup. I tried using WAPP, which is a nice all in one package with Apache+PostgreSQL+PHP5. Everything installed great and worked with my DBMS, but as soon as I tried to connect to the PostgreSQL server with PHP I was quickly shot down with no error messages and no connectivity. So I resorted to return to Linux. I had originally tried using Linux, but had experienced some trouble and hence my switch to Windows. Well after fighting with Windows for a few hours I gave up on it and decided to switch back to Linux. Luckily by piecing together a few install tutorials I have come up with a quick how to of my own for installing PostgreSQL+PHP5+Apache2+PHPPgAdmin.

  1. Start with a Ubuntu Server LAMP install, I’m using Ubuntu 8.04 fully updated.
  2. Install PostgreSQL package, sudo apt-get install postgresql
  3. Install the PHP5-PostgreSQL connector, sudo apt-get install php5-pgsql
  4. Install PHPPgAdmin, sudo apt-get install phppgadmin
  5. Create a symbolic link to the phppgadmin install for Apache2, ln -s /etc/phppgadmin/apache.conf /etc/apache2/sites-enabled/phppgadmin
  6. Change your postgres user’s passwords, both PostgreSQL Role Password and Ubuntu User Password,

    sudo su postgres -c psql template1
    template1=# ALTER USER postgres WITH PASSWORD ‘password’;
    template1=# \q
    exit (to drop back to your own shell prompt if necessary)
    sudo passwd -d postgres
    sudo su postgres -c passwd

  7. Allow your postgres user access to login to PHPPgAdmin,

    sudo nano /etc/phppgadmin/config.inc.php
    Change this line from the default true to false:
    $conf['extra_login_security'] = false;

  8. Finally allow your users to login to the PostgreSQL server,

    sudo nano /etc/postgresql/8.3/main/pg_hba.conf
    Change the fourth column which will read ident, sameuser, md5 or some combination of these to just say trust

Hopefully this will save someone out there some time. Now that I finally have everything working I can see how well PostgreSQL works. I must say MySQL is infinitely easier to setup thanks to these LAMP installs, but maybe it will payoff in the end.

Digg!
Posted under General

Add A Comment