Programming Marathon

Boca Installation
Updated on July 19, 2013
Follow the INSTALL.TXT
Install dependencies
julio@acer ~> sudo pacman -S php php-pgsql php-mcrypt php-gd postgresqlUncomment the following lines in
/etc/php/php.iniextension=pdo_pgsql.so extension=pgsql.so extension=zip.soEdit the PostgreSQL configuration:
listen_addresses = 'localhost' (* = all)Set the encoding of new databases to UTF-8
This step is unnecessary, but without it, you will have to type
ENCODING = 'UTF8'every time you want to create a UTF8 database.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 1Restart PostgreSQL:
julio@acer ~> sudo systemctl restart postgresqlDownload a recent version of Boca: ime.usp.br/~cassio/boca
Unzip the file and move the folder to the server
[root@acer Downloads]# tar xvfz boca-1.4.2.tgz [root@acer Downloads]# mv boca-1.4.2 /srv/http/bocaEdit Apache settings:
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>Create the user “boca”, able to create databases:
julio@acer ~> psql julio=# CREATE USER boca WITH PASSWORD 'OUKLsjVs2GLby79' createdb;As root, edit the file
/srv/http/boca/private/conf.php<?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; } ?>To generate a random key and the boca password, you can use the following command:
julio@acer ~> echo `tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c25`Or another random password generator like
pwgen,makepasswd,apg, orKeePassX.As root, run the following command inside the private folder:
[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
Here it gave a Fatal error: Call to undefined function define_syslog_variables() and I simply
commented out the corresponding line in globals.php.
- Go to http://localhost/boca/src/index.php. The login screen should appear, the username is
systemand there is no password. Create a password inOptions
If it complains that the file conf.php is not readable, run chmod +x private.
NOTE: The website also has a script available that performs automatic installation (downloads updates, creates users, changes the grub, and autoconfigures Boca) but it has a lot of specific things for Ubuntu. If you are using this distribution, download the script HERE.
Installing on a server without root password
Well, Boca ran very well on my computer and is even accessible from the internet, but using my notebook as a server with the connection speed here at home is not very stable. Since I am paying for this server, I decided to install Boca right here.
The process is identical up to step 10, but step 11 needs to be executed as root and I do not have the root password, as the server is shared. The solution is to copy the database that the script created on my computer to the server:
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
Links

I’m a Brazilian computer engineer based in Germany, passionate about tech, science, photography, and languages.
I’ve been programming for about two decades already, exploring everything from mobile apps and web development to machine learning. These days I focus on cloud SRE and data engineering.
I volunteer in the open source and Python communities, helping organize PyCon DE and PyData Berlin, mentoring, and contributing with code and translations.
On my blog, I share Linux tips, setup guides, and personal notes I’ve written for future reference. I hope others find them helpful as well. The content is available in multiple languages.
Browse my gallery for some of my photography.
Away from the keyboard, you’ll find me at concerts, playing clarinet, cycling, scuba diving, or exploring new places, cultures, and cuisines.
Always happy to connect! 🙂