Installing fearqdb on Debian + lighttpd in 10 steps

Today we’re going to install fearqdb (the best quote database out there) on Debian + lighttpd.


  1. Lighttpd + PHP and MySQL installed and working.
  2. Enable the PHP gettext module, if you want to use fearqdb in Spanish:
    echo "" >> /etc/php5/cgi/php.ini

    Then, install the gettext package.

  3. git.


  1. cd to /var/www and clone the git repo there:
    git clone git://
  2. Create a new user and a new database for fearqdb in your MySQL installation. You may use phpmyadmin for that matter, I will use the MySQL internal monitor.
    root@debian:~# mysql -uroot -p
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    mysql> create user 'fearqdb'@'localhost' identified by 'password';
    Query OK, 0 rows affected (0.01 sec)
    mysql> grant usage on *.* to 'fearqdb'@'localhost' identified by 'password';
    Query OK, 0 rows affected (0.01 sec)
    mysql> create database `fearqdb`;
    Query OK, 1 row affected (0.00 sec)
    mysql> grant all privileges on `fearqdb`.* to 'fearqdb'@'localhost';
    Query OK, 0 rows affected (0.01 sec)
  3. Create the “templates/compiled” folder and make it world-writable.
    mkdir fearqdb/templates/compiled
    chmod 777 fearqdb/templates/compiled
  4. Now, let’s edit the lighttpd configuration file. Enable the rewrite module (it’s commented out) and then add a virtual host for the fearqdb:

    $HTTP["host"] == "" {
            server.document-root        = "/var/www/fearqdb"
            url.rewrite-once = ( "" => "/index.php" )

    And then we will use a virtual host for the static content:

    $HTTP["host"] == "" {
            server.document-root        = "/var/www/fearqdb/statics"
            setenv.add-response-header += ( "Expires" => "Thu, 01 Jan 2099 00:00:00 GMT" )

    We are using an Expires header here so our visitors cache the content for faster loading. Now, restart lighttpd.

  5. Edit the config.php file.
  6. Create the database skeleton:

    root@debian:/var/www# mysql -ufearqdb -p fearqdb < fearqdb/sql/quotes.sql
    Enter password:
  7. Create a new virtual host inside the database. You could use phpmyadmin but, again, I will use the MySQL monitor.

    root@debian:/var/www# mysql -ufearqdb -p fearqdb
    Enter password: 
    mysql> insert into sites (domain, site_key, lang, locale, `collate`, ip_show, ip_host, ip_part, analytics_enabled, analytics_code, url, statics_url, snowstorm, db, irc, name, nname, cookie, privacy_level, privacy_level_for_bots, page_size, robots) values ('', 'mysecretkey', 'es', 'es_ES.utf8', 'utf8_spanish_ci', 0, 0, 0, 0, '', '', '', 0, 'general', 'Visit us at our IRC network!', 'QDB', 'qdb', 'qdb_session', 0, 0, 8, 'allow');
    Query OK, 1 row affected (0.00 sec)

    Obviously, you must change the parameters. They are described here.

  8. Create an user inside fearqdb for yourself.
    Imagine you want “password” to be your password. First, you have to generate a four characters long salt for it. Use, for example, this.
    Once you have it, you have to generate the SHA-512 sum out of it. My random string was yb2R, so:

    root@debian:/var/www# echo -n 'yb2Rpassword' | sha512sum
    93475108054d39b0fc3b77b7707bc095570eaaf194d4b84f83e71eb431b0dae3ec491b0cf7e23e015b05905d683475fc160e706b249e39c9fe6afdb508a5d0df  -

    That’s our hashed password. Now, insert it in the database:

    mysql> insert into users (nick, password, salt, db) values ('admin', '93475108054d39b0fc3b77b7707bc095570eaaf194d4b84f83e71eb431b0dae3ec491b0cf7e23e015b05905d683475fc160e706b249e39c9fe6afdb508a5d0df', 'yb2R', 'general');
    Query OK, 1 row affected (0.01 sec)
  9. (Optional) If you want to use fearqdb in Spanish, generate the .mo file:

    root@debian:/var/www# cd fearqdb/locale/es_ES/LC_MESSAGES/
    root@debian:/var/www/fearqdb/locale/es_ES/LC_MESSAGES# msgfmt messages.po

    Then, restart lighttpd and visit your fearqdb page. If it’s still in English, use the locale command to see whether your locale matches the one you configured in the 7th step. If not, you must use dpkg-reconfigure locales to change it.

  10. Submit your first quote! Use the Submit quote button.
    Then, approve it: you can login by browsing to the /userlogin page. Once you’ve done that, you’ll see the quote being transparent; copy the quote’s code (for example, 18aa). Go to the /panel page, paste it in the “permaid” field, select “do_approved” and then click “Perform”. The quote is now approved and therefore it’s public.




A %d blogueros les gusta esto: