Programming Marathon

Installing Boca
Updated on 19 July 2013
Follow the INSTALL.TXT
Install the 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)Make the encoding of new databases UTF-8
This step is not necessary, 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
Extract 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 the Apache configuration:
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 “boca” user, 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 boca’s 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 such as
pwgen,makepasswd,apgorKeePassX.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 me 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 user is
systemand it has no password. Create a password underOptions.
If it complains that the conf.php file is not readable, run chmod +x private.
NOTE: The site also offers a script that does the installation automatically (downloads updates, creates users, changes grub and auto-configures Boca), but it has a lot of Ubuntu-specific bits. If you are using that distribution, download the script HERE.
Installing on a server without the root password
Well, Boca ran very well on my computer and is even reachable from the internet, but using my laptop as a server with the connection speed here at home is not stable at all. Since I am paying for this server, I decided to install boca on it instead.
The process is identical up to step 10, but step 11 has to be run as root and I do not have the root password, since the server is shared. The solution is to copy the database that the script created on my computer over 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-German 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, serving on the PSF D&I Work Group, mentoring, and contributing 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! 🙂