Linode Library Home
Linode Library RSS Feed
Home :: Web Applications :: Social Networking
Print View View Source

Social Networking with Elgg on Debian 5 (Lenny)

Published: by

Warning

This document is an older, unmaintained guide. There may be a new guide available for this software.

Elgg is an open source social networking tool that enables groups of people to create and manage common interest sites that allow users to keep blogs, create profiles, join groups, upload files, and update status messages (known as "microblogs"). Updates are shown in a centralized "information feed" so that users can see updates to their friends' profiles or activities.

The inspiration for Elgg comes from popular "general interest" social networking sites like Facebook and My Space, as well as smaller sites like Friendster and Virb. Nevertheless, Elgg sites generally do not compete with the general interest social networking. Rather, they provide an opportunity for smaller, more tightly knit communities to collaborate, share information, and communicate on the Internet. A list of sites powered by Elgg may offer more insight into Elgg's potential.

Fundamentally, Elgg is a specialized CMS (content management system) designed to power a full-featured social networking site. While a developer familiar with a system like Drupal, Django, or Ruby on Rails could build a site with all of the features of Elgg, the Elgg package consolidates the core functionality for these kinds of sites into a single application.

Before beginning, we assume that you have followed our getting started guide. You will also need to install a LAMP stack before installing Elgg.

If you're new to Linux server administration, you may be interested in our using Linux document series including the beginner's guide and administration basics guide. You will need to be logged into your Linode as root in order to complete the installation process.

Contents

Prerequisites for Installing Elgg

Make sure your package repositories and installed programs are up to date by issuing the following commands:

apt-get update
apt-get upgrade --show-upgraded

Before you can install Elgg, there are a number of software dependencies that must be installed first. Issue the following command:

apt-get install php5-gd php-xml-parser unzip php5-mysql

Elgg also makes use of Apache's mod_rewrite to make more human readable URLs. To enable this module, issue the following command:

a2enmod rewrite

Run the following command to restart the Apache Web server so that mod_rewrite is properly initialized:

/etc/init.d/apache2 restart

You're now ready to install Elgg. For the purposes of this guide, Elgg will be installed at the root level of an Apache virtual host. The DocumentRoot for the virtual host will be located at /srv/www/bucknell.com/public_html/ and the site will be located at http://bucknell.com/. You will need to substitute these paths with the paths that you comfigured in your Elgg virtual host.

Installing Elgg

This document is written against version 1.7 of the Elgg package. Consult the Elgg download page to see if there is a more up to date version of the software.

Enter the directory above your DocumentRoot and download the latest version of the application. Issue the following two commands:

cd /srv/www/bucknell.com/
wget http://elgg.org/getelgg.php?forward=elgg-1.7.zip

You will need to decompress and extract the Elgg files from the archive, and then move them into the DocumentRoot root for your host. Issue the following two commands to accomplish this:

unzip elgg-1.7.zip
mv /srv/www/bucknell.com/elgg-1.7/* /srv/www/bucknell.com/public_html/

Elgg requires a "data/" directory that exists outside of the publicly accessible DocumentRoot to store user submitted content. For the purposes of this guide, this directory is located at /srv/www/bucknell.net/data/. To create this directory, issue the following command:

mkdir /srv/www/bucknell.com/data/

The web server needs to be able to write to the data/ directory; issue the following command to allow this:

chmod 777 /srv/www/bucknell.com/data/

Before you can begin to configure Elgg, you will need to create a MySQL username and password as well as a database for Elgg. You should have created a MySQL database as part of the LAMP setup process, but you can also configure additional databases and user credentials at any time.

Configure Elgg

Elgg has an automated installation process; however, before you begin, several values must be set in Elgg's settings.php file. Issue the following commands, to duplicate the example file provided by the Elgg developers:

cd /srv/www/bucknell.com/public_html/engine
cp settings.example.php settings.php

To configure the database connections, you'll need to edit the file in your preferred text editor and configure the following section. An example of the "standard configuration" follows:

File excerpt:/srv/www/bucknell.com/public_html/engine/settings.php

// Database username
      $CONFIG->dbuser = 'elggdbaccess';

// Database password
        $CONFIG->dbpass = 'lo1lip0p';

// Database name
        $CONFIG->dbname = 'elgg';

// Database server
// (For most configurations, you can leave this as 'localhost')
        $CONFIG->dbhost = 'localhost';

// Database table prefix
// If you're sharing a database with other applications,
// you will want to use this to differentiate Elgg's tables.
        $CONFIG->db prefix = 'elgg_bucknell_';

Replace the relevant information in your config with the credentials for your database. The "dbhost" will be "localhost" unless you're running the database server on a different machine.

Using the Elgg Installation Process

Now visit the Elgg home page. In our example, this is located at http://bucknell.com/. You'll see an error presenting you with code needed for the .htaccess file. Copy this example .htaccess into a new .htaccess file in the DocumentRoot directory.

Edit the /srv/www/bucknell.com/.htaccess file, and paste the content from the Elgg installation process.

When you've saved this file, refresh the page and you'll be presented with the "System Settings" page. Here you will be required to fill out several fields including the name of your site, the site's official email address, and the site URL, among other things. On this page, Elgg will also ask for the full path to the "data" folder that you created during the installation process. In our example, the path to this directory is as follows:

/srv/www/bucknell.com/data/

Elgg allows you to configure several additional options, including the default language, default access permissions, and an option to turn on the debugging mode. Alter any values as you see fit. When you select "Save", the process will continue and allow you to create an administrative account. When this is complete, Elgg is fully installed and you can begin to customize and develop your site. Congratulations, you now have the beginnings of your very own independent, self-hosted social networking site.

Monitor for Software Updates and Security Notices

When running software compiled or installed directly from sources provided by upstream developers, you are responsible for monitoring updates, bug fixes, and security issues. After becoming aware of releases and potential issues, update your software to resolve flaws and prevent possible system compromise. Monitoring releases and maintaining up to date versions of all software is crucial for the security and integrity of a system.

Please monitor the Elgg development mailing list to ensure that you are aware of all updates to the software and can upgrade appropriately or apply patches and recompile as needed.

When upstream sources offer new releases, repeat the instructions for installing the Elgg software as needed.

More Information

You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

Creative Commons License

This guide is licensed under a Creative Commons Attribution-NoDerivs 3.0 United States License.

Last edited by Sharon Campbell on Friday, October 4th, 2013 (r3783).