Programmiermarathon
Installation von BOCA
Aktualisiert am 19. Juli 2013
Folge der Anleitung INSTALL.TXT
Abhängigkeiten installieren:
julio@acer ~> sudo pacman -S php php-pgsql php-mcrypt php-gd postgresqlDie folgenden Zeilen in
/etc/php/php.iniauskommentieren:extension=pdo_pgsql.so extension=pgsql.so extension=zip.soPostgreSQL konfigurieren:
listen_addresses = 'localhost' (* = all)Standard‑Kodierung neuer Datenbanken auf UTF‑8 setzen
Dieser Schritt ist optional, sonst musst du bei jeder DB‑Erstellung „ENCODING = ‘UTF8’“ angeben.
julio@acer ~> psql psql (9.1.2) Type "help" for help. julio=# UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1'; UPDATE 1 julio=# DROP DATABASE template1; DROP DATABASE julio=# CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE'; CREATE DATABASE julio=# UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1'; UPDATE 1PostgreSQL neu starten:
julio@acer ~> sudo systemctl restart postgresqlEine aktuelle BOCA‑Version herunterladen: ime.usp.br/~cassio/boca
Archiv entpacken und Ordner auf den Server verschieben:
[root@acer Downloads]# tar xvfz boca-1.4.2.tgz [root@acer Downloads]# mv boca-1.4.2 /srv/http/bocaApache‑Konfiguration anpassen:
julio@acer ~> sudo vim /etc/httpd/conf/httpd.conf #BOCA <Directory /srv/http/boca> AllowOverride Options AuthConfig Limit Order Allow,Deny Allow from all AddDefaultCharset utf-8 </Directory> <Directory /srv/http/boca/private> AllowOverride None Deny from all </Directory> <Directory /srv/http/boca/doc> AllowOverride None Deny from all </Directory> <Directory /srv/http/boca/tools> AllowOverride None Deny from all </Directory>Benutzer „boca“ mit Recht zum Erstellen von Datenbanken anlegen:
julio@acer ~> psql julio=# CREATE USER boca WITH PASSWORD 'OUKLsjVs2GLby79' createdb;Als root die Datei
/srv/http/boca/private/conf.phpbearbeiten:<?php function globalconf() { $conf["dbencoding"]="UTF8"; $conf["dbclientenc"]="UTF8"; $conf["dblocal"]="false"; $conf["dbhost"]="localhost"; $conf["dbport"]="5432"; $conf["dbname"]="bocadb"; $conf["dbuser"]="boca"; $conf["dbpass"]="senha"; $conf["dbsuperuser"]="senha"; $conf["dbsuperpass"]="senha"; $conf["basepass"]="142857"; $conf["key"]="GG5ALEATORIOjJprR6ex"; $conf["ip"]='local'; return $conf; } ?>Um einen zufälligen Schlüssel und das BOCA‑Passwort zu erzeugen, kannst du Folgendes nutzen:
julio@acer ~> echo `tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c25`Oder Generatoren wie
pwgen,makepasswd,apgoderKeePassX.Als root im Ordner
privateausführen:[root@acer private]# php createdb.php This will erase all the data in your bocadb database. ***** YOU WILL LOSE WHATEVER YOU HAVE THERE!!! ***** Type YES and press return to continue or anything else will abort it: YES dropping database PHP Warning: date(): It is not safe to rely on the system's timezone settings. (…) creating database creating tables creating initial fake contest
Hier trat ein „Fatal error: Call to undefined function define_syslog_variables()“ auf – ich habe die
entsprechende Zeile in globals.php einfach auskommentiert.
- Rufe http://localhost/boca/src/index.php auf. Es sollte der Login erscheinen, der Benutzer ist
systemohne Passwort. Lege eines unterOptionsfest.
Wenn die Datei conf.php als nicht lesbar bemängelt wird, führe chmod +x private aus.
Hinweis: Auf der Website gibt es auch ein Skript zur automatischen Installation (lädt Updates, erstellt Benutzer, ändert den Grub und konfiguriert BOCA), ist aber sehr Ubuntu‑spezifisch. Wenn du Ubuntu nutzt, lade es HIER.
Installation auf Server ohne Root‑Passwort
BOCA lief lokal gut und war sogar aus dem Internet erreichbar, aber meinen Notebook‑Upload als Server zu nutzen ist nichts Stabiles. Also Installation auf dem Hosting.
Der Prozess ist identisch bis Schritt 10, aber Schritt 11 erfordert Root – das Passwort habe ich auf dem Shared‑Server nicht. Lösung: Die vom Skript lokal erstellte Datenbank auf den Server kopieren:
julio@acer ~> pg_dump -C -Fp -f dump.sql -U postgres bocadbjulio@acer ~> scp dump.sql juliobor@juliob.org:~julio@acer ~> ssh juliobor@juliob.orgjuliobor@box780 ~ $ psql -U juliobor_boca -f dump.sql