Just a writing a post for my students. I want them to set up LAMP and Laconica on their Ubuntu desktops for their projects.
LAMP is a software bundle that includes Linux, Apache, MySQL and PHP. In Ubuntu, it is quite simple to set up LAMP. Laconica is an open source microblogging application similar to Twitter. For beginners and even intermediate Linux users, installing Laconica can be frustrating but it need not be. I have successfully installed the basic Laconica package two times already so I will jot down how I did it below for my students.
1. Install LAMP
Install LAMP using this excellent guide from the MAKETECHEASIER blog:
http://maketecheasier.com/setting-up-a-lamp-server-in-ubuntu-hardy-heron/2008/08/06
This blog does a very good job in helping the user seting up a root MySQL password with a graphic user interface. When this is done through the command line, most of us, umm, end up setting our root passwords as password by mistake 🙂 If that happened to any of you, go to this link to recover your root password.
As per the LAMP install guide, test out LAMP with WordPress or just do nano -w /var/www/test.php then write ‘This works with PHP!’ in the file. Go to localhost/test.php to see if it works. If you see ‘This works in PHP!’ then everything is okay. If not, start over, seriously 🙂
2. Install Laconica
I am going to use and edit 0xDECAFBAD‘s guide to getting Laconica running. First, you need to install darcs as follows with apt-get:
$ sudo apt-get install darcs
$ darcs get --partial http://laconi.ca/darcs/
This should create a darcs directory in /home/YOURUSERNAME/darcs.
Of course YOURUSERNAME should be replaced with your actual username (type whoami in command line if you forgot). Change directory into darcs right now before continuing:
$ cd /home/YOURUSERNAME/darcs
Now you will install all the PHP and PEAR based prerequisites and libraries. I also included curl and unzip since some of you may not have already installed it with apt-get yet:
$ sudo apt-get install libapache2-mod-php5 php5-cgi php5-cli php-pear php5-gd php5-mysql unzip curl
$ sudo pear channel-update pear.php.net
$ sudo pear install channel://pear.php.net/Validate-0.8.1
$ sudo pear install DB_DataObject
$ sudo pear install Mail
$ sudo pear install Net_SMTP
$ mkdir extlib xfers
$ cd xfers
$ curl -O http://openidenabled.com/files/php-openid/packages/php-openid-2.1.1.zip
$ curl -O http://michelf.com/docs/projets/php-markdown-1.0.1m.zip
$ curl -O http://oauth.googlecode.com/svn/code/php/OAuth.php
$ curl -O http://xmpphp.googlecode.com/files/xmpphp-0.1beta-r21.tar.gz
$ unzip php-markdown-1.0.1m.zip
$ cp 'PHP Markdown 1.0.1m/markdown.php' ../extlib/
$ unzip php-openid-2.1.1.zip
$ cp -r php-openid-2.1.1/Auth ../extlib/
$ cp OAuth.php ../extlib/
$ tar -zxf xmpphp-0.1beta-r21.tar.gz
$ cp xmpphp/*.php ../extlib/
$ cd ..
$ rm -rf xfers
Now, here is one edit from 0xDEFCAFBAD’s install guide. You will need to obtain the latest release of XMPP to avoid getting errors with your current Laconica install (I got the following from Nick’s comments on OxDECAFBAD’s blog):
$ cd extlib
$ curl -O https://saigonnezumi.com/XMPPHP.tar.gz
$ tar -zxf XMPPHP.tar.gz
$ cd ..
Now you will set up the Laconica database in MySQL. Make sure you are in /home/YOURUSERNAME/darcs
to avoid getting a dataname not found error. Of course PASSWORD in capitals should be YOUR password:
$ mysql -uroot -p -e 'create database laconica';
$ mysql -uroot -p -e "grant all privileges on laconica.* to laconica@localhost identified by 'PASSWORD'";
$ mysql -uroot -p laconica < db/laconica.sql
Now for the configurations which I think can be the most toughest part in installing Laconica:
$ cp config.php.sample config.php
$ nano -w config.php
Add the following to line 6 (Control-C will tell you the line number in nano):
#If you have downloaded libraries in random little places, you
#can add the paths here
define(‘INSTALLDIR’, dirname(__FILE__));
set_include_path(get_include_path() . PATH_SEPARATOR . INSTALLDIR . ‘/extlib’);
Edit the rest of the settings, read my comments (followed by # to explanations). (The author ASSUMES that you created a laconica database under root).
$config[‘site’][‘name’] = ‘Laconica Microblog’; #Your Microblog Name
$config[‘site’][‘server’] = ‘localhost’; #Your server name, I used localhost for now
$config[‘site’][‘path’] = ‘laconica’; #The directory name in /var/www/laconica
$config[‘site’][‘fancy’] = true; #See OxDECAFBAD for more explanation
$config[‘site’][‘theme’] = ‘default’; #You actually have two theme choices
$config[‘site’][’email’] = ‘[email protected]’; #Your Email
$config[‘site’][‘broughtby’] = ‘Laconica Microblog, Inc.’; #You of course 🙂
$config[‘site’][‘broughtbyurl’] = ‘http://yourdomain.com’; #Your website URL
$config[‘db’][‘database’] = ‘mysql://root:PASSWORD@localhost/laconica’; #Your ROOT MySQL password;
$config[‘db’][‘ini_laconica’] = $config[‘db’][‘schema_location’].’/stoica.ini’;
After you made your changes, press Control-X to exit and save.
Now we will edit dataobject.ini (The author ASSUMES that you created a laconica MySQL database under root):
$ nano -w dataobject.ini
database = mysql://root:PASSWORD@localhost/laconica #Your Laconica password, not root password
schema_location = /var/www/localhost/docs/laconica/classes
class_location = /var/www/localhost/docs/laconica/classes
require_prefix = /var/www/localhost/docs/laconica/classes/
Control-X to exit and save.
As you noticed, I selected the server name to be localhost instead of a domain name. You can add this later. I just wanted to write this tutorial for my students. You can also use your computers IP address to test Laconica locally in your home or classroom. I like to keep things simple with my students.
Be sure to change user and file permissions for the avatar folder:
$ sudo chown -R www-data avatar
$ sudo chmod -R ug+rw avatar/
Now, since this guide is for my students, I will make things easier for them to get Laconica running on their servers.
$ cd ..
$ sudo ln -s darcs
/var/www/laconica
$ cd /var/www/
$ ls
You should see laconica listed as one of the directories. I also changed the ownership and file permissions as well just to keep things simple for my students. We will make their projects live, then we will focus more on security.
$ sudo chown YOURUSERNAME laconica
$ sudo chmod 777 laconica
Now, to see if Laconica works, click the following link:
If you get any errors, they are normally with the configurations files in config.php and/or dataobject.ini.
That’s all for now. Now, I have not tested Jabber or the mail server features with the current install of Laconica yet. Hopefully I will get to it sometime this week. In the meantime, I hope my students can have fun with their own Twitter-like application 🙂
Any input and corrections to this guide are greatly appreciated. Thanks to OxDECAFBAD for his excellent guide.
Edit 1: I got the original symlinks backwards, corrected now. Thanks Tommy for bringing it up.
Edit 2: added cp config.php.sample config.php to make it easier for my students
Edit 3: added bold/strong tags so students would not forget to add two lines for config.php
Edit 4: You can download an edited version of config.php here in case you lost your copy (Yeah, this is for my students). I renamed it to config.txt so it would appear online so do the following: mv config.txt config.php
Edit 5: Forgot to add cd extlib so the XMPPHP ended being in the wrong director. Corrected.
Edit 6: For some, connecting the database to Laconica was difficult. I edited both config.php and dataobject.ini and replaced the username laconica with root. I have a hunch many new users created their MySQL database under root.
Edit 7: Added curl to apt-get install since some of you may not have installed it yet.
mike pham says
why don’t u go ahead and show some screen-shots of the project? 🙂
SaigonNezumi (Kevin) says
@Mike: Tommy is still trying to set it up on his computer. I have Laconica running but I cannot get my modem to forward to port 80 until I get a static IP to work.
IT_V says
i got it.. but i got some fartal error on Openid … and sreach tabs
mike pham says
can you bring your Live CD tomorrow?
IT_V says
DONE
david says
were you able to get jabber setup?
SaigonNezumi (Kevin) says
@David, I have not tried it yet. I want to get Laconica running on a Gentoo system before I try.
andyswarbs says
Creating the symbolic link did not work for me. It came up with “bad link”. So I used
sudo ln -s /home/andy/darcs /var/www/laconica
instead and that seems (so far) to work fine.
Andrew Abogado says
Thank you very much for this tutorial. You are right. The hardest part was editing config.php. I’m now one of the satisfied students. 🙂