This article covers a version of Ubuntu that is no longer supported. If you are currently operate a server running Ubuntu 12.04, we highly recommend upgrading or migrating to a supported version of Ubuntu:
Reason: Ubuntu 12.04 reached end of life (EOL) on April 28, 2017 and no longer receives security patches or updates. This guide is no longer maintained.
See Instead: This guide might still be useful as a reference, but may not work on other Ubuntu releases. If available, we strongly recommend using a guide written for the version of Ubuntu you are using. You can use the search functionality at the top of the page to find a more recent version.
Elgg is an award winning PHP engine for running your own full fledged social network. It has great community support in the form of plugins and themes made by official developers and the user community.
Debian 7 or Ubuntu 12.04
Apache (with rewrite module)
PHP 5.2+ (few modules required to support some of the features)
MySQL 5+
It is a good idea to do a total system update before doing anything else.
apt-get update
apt-get upgrade
Install apache and mysql first by doing
apt-get install apache2 mysql-server
During the mysql-server installation, you have to input a password for the root user. Using a strong password and noting it down is a good idea, as you will have to use it to create a database and a user for Elgg later.
After installing apache, the rewrite module that Elgg requires should be enabled by running:
a2enmod rewrite
The default apache configuration ignores .htaccess
files in the “document root” (/var/www
by default). But this is required for url rewriting in Elgg to work.
Change the apache configuration by opening it in nano, vim, or any editor you like.
nano /etc/apache2/sites-available/default
In this file, replace AllowOverride None
with AllowOverride All
in the Directory
section defined for /var/www
folder.
After the configuration file is edited and saved, do an apache server restart:
service apache2 restart
It is a good idea to create a new database user instead of using root for Elgg’s purpose. Get into the MySQL command line by running:
mysql -u root -p
Execute the following queries to create a new database, a user for Elgg, and grant the database access to this user.
CREATE DATABASE elgg;
CREATE USER elgguser IDENTIFIED BY 'elggpassword';
GRANT ALL ON elgg.* TO elgguser;
The following command installs php along with few modules Elgg needs for some of it’s features to work.
apt-get install php5 php5-gd php-xml-parser php5-mysql unzip
Go to your webserver’s root directory and download Elgg’s source code.
cd /var/www/
wget http://elgg.org/getelgg.php?forward=elgg-1.8.18.zip -O elgg.zip
Unzip and remove elgg.zip and unwrap the folder enclosing the code.
unzip elgg.zip && rm elgg.zip
mv elgg-1.8.18/* . && rmdir elgg-1.8.18
Elgg uses a data directory to store user uploaded and system generated data. Create a folder outside the webserver’s root directory and make it writeable by the webserver.
mkdir <span style='color: red'>/var/elggdata</span>
chown -R www-data:www-data /var/elggdata
www-data
is apache’s user that writes to file system. The above command grants apache ownership of the data directory.
Now move the .htaccess
file and the settings.php
files to their places.
mv /var/www/htaccess_dist /var/www/.htaccess
mv /var/www/engine/settings.example.php /var/www/engine/settings.php
Open up the settings.php
file and fill in the database access details.
nano /var/www/engine/settings.php
Make sure to set the right values to the following variables in the file.
$CONFIG->dbuser = 'elgguser';
$CONFIG->dbpass = 'elggpassword';
$CONFIG->dbname = 'elgg';
$CONFIG->dbhost = 'localhost';
$CONFIG->dbprefix = ''; // or anything else you like
If you followed all the steps in this article, the install will be a breeze for you. Open up the browser and navigate to /install.php
of your website(‘example.com’, etc.) or your ip address (‘128.199.246.37’, etc.).
http://example.com/install.php
or
http://128.199.246.37/install.php
That’s it! You should see the installation page with instructions about various steps involved in the process. Elgg will create the database and ask for few site specific details and even creates the admin user for you in the subsequent steps.
Elgg has great community support. If you are stuck anywhere just head over to the community site. There are quite a few people ready to help you with anything you may need.
<div class=“author”>Article Submitted by: <a href=“http://serenecode.org/”>GP</a></div>
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
@s.gaggini
Glad you got it running, and thanks for catching that typo! We’ll get that fixed now.
Error depends on some configuration on my old droplet, on my brand new droplet it runs fine.
$CONFIG->dbpass = ‘elggpasswor’; should be elggpassword
Even after fixing that mistake I can’t install, I get error “DatabaseException:WrongCredentials” during elgg install procedure.
Really?! Username in config inside < SPAN >???
Hello,
This is an awesome tutorial, it worked first time without any problems whatsoever! Not an easy thing to do when writing a tutorial. :-)
However, I’ve been trying to install this on my Raspberry Pi and whilst it works first time with Apache, I would like to use nginx as it is much more lightweight and less resource intensive.
There are various hints online about how to do this but I haven’t found anything useful, could you help me do this or if not could you point me in the direction of a solution please?
Again, many thanks!