2007年11月19日 星期一

Install PostgreSQL 8.2.5 Server on Debian 4.0

Instead of applying command apt-get, the PostgreSQL database server will be installed from source on the standard base only debian to get the update to date PostgreSQL working,
  1. Install C compiler and dependencies
    • apt-get install gcc libc6-dev libreadline5-dev zlib1g-dev
      • gcc library could be got from installation cd
      • gcc-4.1 and libssp0 (4.1.1-21) were installed
      • linux-kernel-headers was setting up
      • libc6-dev (2.3.6.ds1-13etch2) was setting up
      • .....
  2. Download PostgreSQL source
    • wget ftp://ftp4.tw.postgresql.org/pub/postgresql/source/v8.2.5/postgresql-8.2.5.tar.gz
    • tar vxf postgresql-test-8.2.5.tar.gz
  3. Make and install
    • change directory to postgresql-8.2.5
    • ./configure
    • make
    • su
    • make install
      • installed at /usr/local/pgsql
    • adduser postgres
      • Change password by : passwd postgres
    • mkdir /usr/local/pgsql/data
    • chown postgres /usr/local/pgsql/data
    • su - postgres
    • /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
      • This is to create initial management databases.
  4. Startup PostgreSQL Server
    • su - postgres
    • /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
    • Or /usr/local/pgsql/bin/pg_ctl start -D /usr/local/pgsql/data -l logfile
      • logfile would be output at the place that user 'postgres' has write priviledge
  5. Create new database (named test)
    • su - postgres
    • /usr/local/pgsql/bin/createdb test
  6. Test connection
    • su - postgres
    • /usr/local/pgsql/bin/psql test

沒有留言: