Here's a quick howto on installing Laconica on Debian 5.0 (Lenny) with a PostgreSQL database backend.

Laconica is an opensource micro-blogging platform written in PHP. The software was developed by Control Yourself, a Canadian organisation, and is deployed on Identi.ca, which can be seen as a Twitter competitor offering a more 'free' alternative (data is released under Creative Commons, autonomous Laconica installations can connect to other nodes to build a network of co-operative microblogging stations, etc, see here for more)

I once wrote a howto for building a highly-available Laconica setup using Heartbeat and DRBD for data replication and failover. But I've lost my notes :(

With the release of Debian Lenny, it's easier than ever to install Laconica. Debian Etch didn't offer php5-gmp, for example, which made it that little bit more difficult to get a working installation up. There are notes on how to install using Debian Etch written by a fellow called Ciaran

This assumes not even Apache2 is installed, nor PostgreSQL. If you already have an Apache / Postgres server(s) set up, you can make the necessary modifications to install only the packages you still need. I do assume that you have a working outgoing mail server on this machine that can send e-mail notifications to users to confirm their newly-registered accounts and so on. On this machine, I'm just running Postfix.

Let's install Apache, PostgreSQL, PHP5, and the various PHP5/apache support packages required.

apt-get install apache2 php5 libapache2-mod-php5 php5-pgsql libgmp3c2 postgresql-8.3 php5-gmp php5-curl php5-gd

My <Directory /var/www> in /etc/apache2/sites-available/default looks like this:

	<Directory /var/www/>
		AllowOverride All
		Order allow,deny
		allow from all
		AddType application/x-httpd-php .php .html
	</Directory>

Enable mod_rewrite for Apache

a2enmod rewrite
Enabling module rewrite.
Run '/etc/init.d/apache2 restart' to activate new configuration!
/etc/init.d/apache2 restart

Enter the directory

cd /var/www

Download the latest Laconica (at the time of writing, 0.7.4)

wget http://laconi.ca/laconica-0.7.4.tar.gz

Extract the tar into the current directory

tar zxfv laconica-0.7.4.tar.gz

Rename the directory to something more sane

mv laconica-0.7.4 laconica

Enter the directory

cd laconica 

Rename the htaccess and config scripts

cp htaccess.sample .htaccess
cp config.sample.php config.php

Allow www-data user ability to write to the avatar directory to upload user avatars

chown www-data:www-data avatar/

Become the Postgres user to prepare the database

su postgres

Create a database user, and be prompted to enter a password

createuser laconica -P
Enter password for new role: 
Enter it again: 
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n

Create a database and make the owner the user you just created.

createdb -O laconica laconica

Now enter the database as the user, and import the pre-prepared SQL schema

psql -U laconica laconica -W -h localhost < db/laconica_pg.sql 

Exit from the postgres shell

exit

Edit .htaccess and change the RewriteBase from it's default 'mublog' to, in my case, 'laconica/'

vim .htaccess

RewriteEngine On
 
# NOTE: change this to your actual Laconica path; may be "/".
 
RewriteBase /laconica/
 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?p=$1 [L,QSA]
 
<FilesMatch "\.(ini)">
  Order allow,deny
</FilesMatch>

Let's edit the config.php to customise our settings.

vim config.php

You'll want to edit the following: (note: mysql references are the default in the config, changes to pgsql have been made per below. Also note quote_identifiers is switched to 'true' from false, and this line and its following 'type' are uncommented)

$config['site']['name'] = 'Just another Laconica microblog';
$config['site']['server'] = 'localhost';
$config['site']['path'] = 'laconica';
$config['db']['database'] = 'pgsql://laconica:yourpassword@localhost/laconica';
 
#Database type. For mysql, these defaults are fine. For postgresql, set
#'quote_identifiers' to true and 'type' to 'pgsql':
$config['db']['quote_identifiers'] = true;
$config['db']['type'] = 'pgsql';

Once this is done, you should be able to visit http://localhost/laconica in your browser and see your Microblogging site! Now you just need to Register as the first user (there's no concept of an 'admin' user as far as I can see, with Laconica) and get microblogging like I did!

(excuse the small screenshot, I did this whole thing on my eeePC while waiting for dinner to cook)

Excellent Debian/Laconi.ca Instructions

Great instructions! They solved my Laconica 0.8.0 setup with MySQL. I was stuck trying to recreate my GoDaddy Linux-host-adapted Laconica 0.8.0 installation on my own Debian 5.0.2 setup with no luck. Per your instructions, I essentially had to undo my GoDaddy adaptations, graft in your /etc/apache2/sites-available/default entry, apply the permissions you noted for www-data, and enable the rewrite module.

Here are the other changes that only apply to GoDaddy Linux hosting that I had to undo for the Debian 5.0.2/Apache 2.2 setup per your recipe:

For Godaddy compatibility .htaccess needed the following additions:

AddHandler x-httpd-php5 .php
AddHandler x-httpd-php .php4

For GoDaddy, in config.php the following line needed to be uncommented:

$config['site']['fancy'] = false;

BTW, why would I do this on my own box if I'm already using the cheapest GoDaddy hosting? Because GoDaddy's basic hosting provides no access to /usr/bin/file, a key component in MIME extraction for the new file attachment feature in Laconica! No way I was going to get upsold from about $80/year to $500/year for hosting just to access the free file, file. No, neither phone support nor a ticket with GoDaddy yielded access to this basic, little, default program file.

~ Steve Jazic

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <perl>, <php>, <python>, <ruby>. Beside the tag style "<foo>" it is also possible to use "[foo]".

More information about formatting options

CAPTCHA

This question is for testing whether you are a human visitor and to prevent automated spam submissions.