Platform:FreeBSD

Uit EekBoek
Naar navigatie springenNaar zoeken springen

Deze pagina bevat alle relevante onderdelen voor het installeren en configureren van EekBoek op een FreeBSD omgeving. Alle de hieronder genoemde stappen moeten worden uitgevoerd als root (su).


Installatie

Op FreeBSD is er een aantal manieren om de EekBoek installatie uit te voeren: via de sources en via CPAN. Er is geen port van EekBoek op FreeBSD.

Voorafgaand aan een installatie controleer eerst of EekBoek niet eerder is geinstalleerd:

locate ebshell

Zodoende kan worden nagegaan dat eventuele bestaande administraties of schemas niet onbedoeld worden overschreven in de volgende stappen.

Source based installatie

Hieronder een script voor de installatie van EekBoek versie 2.01.02 vanaf de sources:

fetch http://www.eekboek.nl/dl/EekBoek-2.01.02.tar.gz
tar xzf EekBoek-2.01.02.tar.gz
cd EekBoek-2.01.02

pkg_add -r p5-DBI
pkg_add -r p5-DBD-SQLite
pkg_add -r p5-Archive-Zip
pkg_add -r p5-HTML-Parser
pkg_add -r p5-ReadLine-Gnu

perl Build.PL
./Build
./Build test
./Build install

Dit script duurt ongeveer 1 minuut op stock hardware.

CPAN installatie

Installatie via CPAN werkt als volgt, waarbij de installatie van 'Term::ReadLine::Gnu' optioneel is:

perl -MCPAN -e 'install EekBoek'
perl -MCPAN -e 'install Term::ReadLine::Gnu'

Wanneer er een aantal vragen verschijnt, kan door Enter te typen de installatie worden afgerond. EekBoek wordt geinstalleerd in de home directory van de user die is ingelogd.

Troubleshooting

  • Als de installatie van de dependencies niet wil lukken, controleer dan of de laatste versie van FreeBSD gebruikt wordt: "uname -a" moet een versie van 7.0 of hoger opleveren.
  • Bij het verschijnen van het volgende bericht bij de laatste stap van het script:
FreeBSD: Registering installation in the package database
Can't open file Makefile: No such file or directory at (eval 40) line 2

dan kan EekBoek alsnog worden opgestart met /usr/local/bin/ebshell. Noot: niet duidelijk is wat de melding betekent, aangezien het niet om een foutmelding gaat.

Installatie GUI

De GUI van EekBoek kan als volgt worden geinstalleerd:

perl -MCPAN -e 'install Wx'

Na afloop moet tevens het volgende commando worden gegeven:

chmod +x /usr/local/bin/ebwxshell

Installatie PostgreSQL

De volgende commando's in de shell installeren postgresql versie 9.1:

pkg_add -r postgresql91-server postgresql91-client

Of anders:

cd /usr/ports/databases/postgresql91-server/ && make install clean
cd /usr/ports/databases/postgresql91-client/ && make install clean

Een uitgebreidere methode voor het installaren van PostgreSQL op FreeBSD die aansluit bij het gebruik van EekBoek is de onderstaande. Bewaar de volgende regels in een bestand genaamd bijvoorbeeld install-postgresql.sh:

#!/bin/sh

# This script assumes the following:
# - there is a user called eekboek and has a folder in /home
# - the eekboek dependencies have been installed successfully
# @todo: for educational purposes a distinction could be made between user eekboek and database eekboek
# @todo: include the creation of the file postgresql.conf in /usr/local/pgsql/data/

# set package source location
MIRROR=ftp://ftp.nl.FreeBSD.org
export PACKAGEROOT=$MIRROR

# disable echo to protect the password
stty -echo

# input postgresql password for user eekboek
echo -e "Please enter password for standard user of the database server: \c"
read PASSWORD

# restore the echo
stty echo

# set standard installation path
target=/usr/home/eekboek

# install postgresql
pkg_add -r postgresql91-server
pkg_add -r postgresql91-client
grep -q 'postgresql_enable="YES"' /etc/rc.conf || echo 'postgresql_enable="YES"' >> /etc/rc.conf

# set init flags for postgresql
echo 'postgresql_initdb_flags="--encoding=utf-8 --lc-collate=C -W -A md5"' >> /etc/rc.conf

# create data folder for postgresql
mkdir /usr/local/pgsql/data
chown eekboek /usr/local/pgsql/data

# create users for database
touch $target/install.sql
echo "create user eekboek with password '$PASSWORD';" >> /root/install.sql

# create script that sets up postgresql and creates database eekboek
touch $target/pgsql.sh

# configure postgresql: database name 'eekboek' and database user 'eekboek' 
echo '
/usr/local/bin/initdb -D /usr/local/pgsql/data
/usr/local/bin/postmaster -D /usr/local/pgsql/data
echo -e "Postgresql is starting up, please wait...\n"
echo -e "Press Enter to continue:\c"
read INPUT_ENTER
/usr/local/bin/createdb eekboek'>> $target/pgsql.sh

# make the script executable
chmod a+x $target/pgsql.sh

Geef chmod +x install-postgresql.sh en draai dit script als root. Ga tenslotte naar /usr/home/eekboek en geef het volgende commando:

./pgsql.sh

Configuratie

Ga na dat alle configuraties goed staan in het configuratie bestand:

vi .eekboek/admdir/eekboek.conf

De geldige instellingen voor dit bestand staan op de EekBoek website. Let op: het bestand eekboek.conf mag niet gewijzigd worden ten tijde dat EekBoek draait, anders crasht EekBoek.

[todo: hier moet een paragraaf komen te staan over een niet-standaard configuratie van EekBoek, zoals een alternatief schema, of een upload van relaties]

EekBoek gebruiken

Commando "ebshell" leidt tot "Command not found": voer bovenstaande stappen nog een keer uit beginnend vanaf "perl Build.PL"; de stap "./Build test" kan hierbij worden overgeslagen. Als dit ook niet werkt, kijk dan of /usr/local/bin in het pad staat: "env | grep PATH". Geef vervolgens het commando "chmod +x /usr/local/bin/ebshell".

Om EekBoek te gebruiken, geef dan het volgende commando:

/usr/local/bin/ebshell

of indien /usr/local/bin in het pad staat, kortweg:

ebshell