Agras Zeta Atino

Un blog mas de tecnologia, locuras y procrastinacion

Compilando PostgreSQL 9 Beta 1

¿Has sentido ganas de compilar PostgreSQL 9-beta-1? ¿Tienes ese impulso de pasión por descubrir que trae de nuevo?

Puedes hacerlo en X sencillos pasos:

  1. Descarga las fuentes:  http://www.postgresql.org/ftp/source/v9.0beta1/
  2. Luego de descargar, descomprimir con su herramienta favorita (tar -xvvzf o tar -xvvjf por nombrar un ejemplo)
  3. Moverse al directorio que se acaba de crear (postgresql-9.0beta1) y revisar las opciones de compilación (./configure –help)
  4. Instalar librerías necesarias,  de acuerdo con lo que se desee habilitar:

    libreadline-dev (Opcional, podrias usar –without-readline (revisar este link)
    libpam-dev (–with-pam)
    libxml2-dev (–with-xml)
    Soporte para lenguajes procedimentales o PL
    perl-dev (–with-perl)
    python-dev (–with-python)

  5. finalmente:

    ./configure –with-pgport=5433 –with-perl –with-python –with-pam –with-openssl –with-libxml –prefix=$(pwd)/../pg9

  6. make && make:
  7. Al final del make veras un mensaje similar a este: All of PostgreSQL successfully made. Ready to install
  8. Al final del make install veras otro mensaje similar: PostgreSQL installation complete.
  9. A jugar!:  PGDATA=$(pwd)/pg_data bin/initdb

Luego de todo esto, deberías tener una salida similar a esta:

foursixnine@quaoar:~/proyectos/postgresql/pg9$ PGDATA=$(pwd)/pg_data bin/initdb
The files belonging to this database system will be owned by user “foursixnine”.
This user must also own the server process.

The database cluster will be initialized with locale es_VE.UTF-8.
The default database encoding has accordingly been set to UTF8.
The default text search configuration will be set to “spanish”.

fixing permissions on existing directory /home/foursixnine/proyectos/postgresql/pg9/pg_data … ok
creating subdirectories … ok
selecting default max_connections … 100
selecting default shared_buffers … 28MB
creating configuration files … ok
creating template1 database in /home/foursixnine/proyectos/postgresql/pg9/pg_data/base/1 … ok
initializing pg_authid … ok
initializing dependencies … ok
creating system views … ok
loading system objects’ descriptions … ok
creating conversions … ok
creating dictionaries … ok
setting privileges on built-in objects … ok
creating information schema … ok
loading PL/pgSQL server-side language … ok
vacuuming database template1 … ok
copying template1 to template0 … ok
copying template1 to postgres … ok

WARNING: enabling “trust” authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

bin/postgres -D /home/foursixnine/proyectos/postgresql/pg9/pg_data
or
bin/pg_ctl -D /home/foursixnine/proyectos/postgresql/pg9/pg_data -l logfile start

Si todo va bien… ¡Felicitaciones, ya tienes instalado PostgreSQL en tu sistema (en mi caso, lo instale dentro de mi usuario, para no tener que estar usando sudo, o crear un script de inicio siempre…). Para verificar que esta todo bien:

foursixnine@quaoar:~/proyectos/postgresql/pg9$ bin/psql –port 5433 postgres
psql (9.0beta1)
Type “help” for help.

postgres=#
postgres=# q
foursixnine@quaoar:~/proyectos/postgresql/pg9$ bin/createlang -p 5433 -d postgres plperl
foursixnine@quaoar:~/proyectos/postgresql/pg9$ bin/createlang -p 5433 -d postgres plpythonu
foursixnine@quaoar:~/proyectos/postgresql/pg9$ bin/createlang -l -p 5433 postgres
Procedural Languages
Name | Trusted?
———–+———-
plpgsql | yes
plperl | yes
plpythonu | no

compiling php5-simplexml

Ever had a problem compiling php5-simplexml on a FreeBSD system?. If you’ve been having trouble and the compiller complaining about not finding something related with a php extension named “spl”; Congratulations, you’ve been googling and found the right place to tell you: Upgrade your PHP to a 5.3.x version, since the SPL extension was removed.

Check the PHP5 Changelog and look for php 5.3.0:

Improved SPL extension:

  • Added SPL to list of standard extensions that cannot be disabled. (Marcus)

:) Will save you lots of time…

Create a PostgreSQL database/cluster with a different encoding

This is a simple way to create a PostgreSQL database/instance with another encoding than your default’s (e.g.: EUC_JP instead of UTF-8).

in most debian-based distros (For example in ubuntu, and debian itself), you can simply use the following command to create (and afterwards run) a PostgreSQL database cluster with a an encoding other than default.

LC_ALL=C /usr/lib/postgresql/8.4/bin/initdb -E EUC_JP -D $(pwd)

After this, you will se a message telling you to start the database and stuff… and that’s it. You just have to be carefull when starting the database, since the command configures everthing to be working with the port 5432 which is postgresql’s default port. Also, you may have to set the permissons.

This also gives another advantage, have multiple databases with different encodings, as the regional configuration of the cluster is set to C. This link to the PostgreSQL’s official docs, explains why you have to do this kind of magic to be able to have something like this. Just an advice:

BE CAREFULL.

Social links powered by Ecreative Internet Marketing