FreeBSD y Postgresql
Vamos a instalar el servidor de base de datos postgresql en la version 8.2 en un FreeBSD 7, utilizando el sistema de ports.
- Instalacion
# cd /usr/ports/databases/postgresql82-server/
# make install
- Configuracion
# mcedit /etc/rc.conf //para arrancar postgres desde el boot
postgresql_enable=”YES”
Instalacion de la B/D:
/usr/local/etc/rc.d/postgresql initdb
Iniciar el servicio:
# su – pgsql
$ /usr/local/bin/postgres -D /usr/local/pgsql/data
Creamos una base de datos de prueba
$ createdb demo
$ psql demo
Welcome to psql 8.2.5, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
demo=#
Para los que deseen pueden instalar phpPgAdmin que es una interfaz web para la administración de PostgreSQL, parecido al phpmadmin del MySQL, para esto suponemos que ya tenemos instalado, apache, php y el modulo de conexion de php a postgresql:
# cd /usr/ports/databases/phppgadmin/
# make install
Y Creamos un usuario para administrar desde la web:
# su – pgsql
$ createuser -P
Enter name of role to add: corredorx
Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) y
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) y
Y ya podemos administrar postgresql desde la web