Home Free Stuff Tutorials Installing PostgreSQL on the PlayStation 2 Linux Platform
  • E-mail
  • Print
  • PDF

Install PostgreSQL database server on the PlayStation 2.

PostgreSQL is a powerful, open source relational database system that boasts full support for foreign keys, joins, views, triggers, and stored procedures (in multiple languages), and is fully ACID compliant. It has more than 15 years of active development and a proven architecture that has earned it a strong reputation for reliability, data integrity, and correctness. This tutorial will tell you how to get a PostgreSQL server running on your Playstation 2 Linux system!

Compiling and Installing PostgreSQL

  1. Log in via a shell and su to become root.
  2. Create a user and group named "postgres"; this is the unprivlidged user that PostgreSQL runs under.
  3. Download the PostgreSQL gzip archive.
  4. Gunzip the archive with gunzip postgresql-7.x.x.tar.gz
  5. CD to the /usr/src directory
  6. Change to the postgres user that you created in step two; this will ensure that the files are owned by postgres when you untar the archive in the next step.
  7. Un-tar the archive with tar -xvf /{path_to_tar}/postgresql-7.x.x.tar
  8. Switch to the directory created when you un-tarred the archive
  9. CD to the tar archive directory. This should be /usr/src/postgresql-7.x.x.
  10. 1Switch to the /src/include/port/ directory and edit the linux.h file with Vi or another text editor. Comment out the following lines
    #elif defined(__mips__)
    typedef unsigned int slock_t;

    #define HAS_TEST_AND_SET


    so that it now reads


    #elif defined(__mips__)
    /* typedef unsigned int slock_t; */

    /* #define HAS_TEST_AND_SET */
  11. Switch back to the source directory /usr/src/postgresql-7.x.x.
  12. Run
    ./configure --build=mipsel-unknown-linux-gnu --disable-spinlocks2
    (and any other switches such as PERL support, SSL support, or *changing the default data directory. Run ./configure --help or consult the PostgreSQL documentation for specific configuration options.)
  13. Run make (NOTE: This takes about an 1-11/2 hours.)
  14. Run make check to run the regression test and verify that the build was successful. (DO NOT do this as root ... su to the unprivlidged user postgres before doing this.)
  15. Run make install to install. (Run this as root.)
  16. Once the install has completed, then you will need to initate the postgresql template database by running the initdb command. (Use the full path if you did not install the executables into a directory in your path; i.e. /usr/sbin or /usr/local/sbin)

* Ensure that this directory is owned by postgres user and group with 0744 permissions

Post Installation - Header files

If you will be using pl/PGSQL with PostgreSQL (i.e. defining your own data types or building stored proceedures), you will need to install the pl/PGSQL header files. To do this, simply type make install-all-headers while still in the source director from which you did the install.

Post Installation - Automatic startup

Most users will want the database to start when the system boots up. The source distro has a start up scripts located in the /{source_path}/contrib/start-scripts directory. I, however, never had any luck getting the linux script to work correctly. I got around this by obtaining a copy of the startup script that is installed on a Red Hat Linux 7.3 distro and changing some of the variables to match my system and the PostgreSQL version that I installed (the PostgreSQL version that ships with RH 7.3 is PostgreSQL 7.2). Worked like a charm!

Withe either script, it needs to be placed in the system initialization directory owned by root with 0700 permissions. You can then add a soft link to the startup script in each individual rulevel directory where you want the service to start. (TIP: To make life easier, I suggest using Webmin to do the last step. Don't have Webmin installed? It's a HIGHLY RECOMMENDED addition. Read my tutorial on how to install Webmin on the PS2!)