Introduction
An outstanding PHP engine, Elgg, can be utilized for operating your own well-developed social network. Great community support is provided through themes and plugins developed by user community and the official developers.
Requirements
- Ubuntu 12.04 or Debian 7
- Apache (with rewrite module)
- MySQL 5+
- PHP 5.2+ (few modules are needed for supporting some features)
Installation
A good idea would be to perform total update of the system before starting anything else.
apt-get update
apt-get upgrade
Installing web and database server
mysql and apache can be installed by doing
apt-get install apache2 mysql-server
During the installation of mysql-server, you need to input a password for the root user. Utilize a robust password and note it down somewhere as you will utilize it for creating a user and a database later for Elgg.
Configuring apache
After installation of apache, Elgg requires the rewrite module which can be enabled by the command below:
a2enmod rewrite
The default configuration of apache ignores .htaccess
files in the “document root” (/var/www
by default). However it is needed for url rewriting in Elgg to operate.
Next the apache configuration needs to be changed by opening it in any editor, like vim or nano.
nano /etc/apache2/sites-available/default
In the above file, replace AllowOverride None
with AllowOverride All
in the Directory
section that’s defined for /var/www
folder.
On editing and saving the configuration file, restart the apache server:
service apache2 restart
Creating MySQL user and database
Rather than utilizing root for the purpose of Elgg, a good idea would be to develop a new database user. You can get into MySQL command line by operating the command below:
mysql -u root -p
The queries given below need to be executed for creating a new database, an Elgg user, and for granting the database access for this user.
CREATE DATABASE elgg;
CREATE USER elgguser IDENTIFIED BY 'elggpassword';
GRANT ALL ON elgg.* TO elgguser;
Installing PHP
The command given below deploys PHP along with few other modules required byElgg for proper functioning of some features.
apt-get install php5 php5-gd php-xml-parser php5-mysql unzip
Downloading Elgg
You need to go to root directory of your your webserver and download the source code ofElgg.
cd /var/www/
wget http://elgg.org/getelgg.php?forward=elgg-1.8.18.zip -O elgg.zip
Now elgg.zip needs to be unzipped and removed and the folder enclosing the code should be unwrapped.
unzip elgg.zip && rm elgg.zip
mv elgg-1.8.18/* . && rmdir elgg-1.8.18
Configuring Elgg for Install
Setting up data directory
Elgg utilizes a data directory for storingsystem generated and user uploaded data. A folder needs to be created outside the root directory of the webserver and it needs to be made writeable by the webserver.
mkdir <span style='color: red'>/var/elggdata</span>
chown -R www-data:www-data /var/elggdata
www-data
is user of apache that performs writing to file system. The command given above provides data directory’s apache ownership.
.htaccess and settings.php
Now the .htaccess
file and the settings.php
files need to be moved to their places.
mv /var/www/htaccess_dist /var/www/.htaccess
mv /var/www/engine/settings.example.php /var/www/engine/settings.php
Editing settings.php
Open up the settings.php
file and complete the access details of the database.
nano /var/www/engine/settings.php
In the file, ensure that right values are set to the variables given below.
$CONFIG->dbuser = 'elgguser';
$CONFIG->dbpass = 'elggpassword';
$CONFIG->dbname = 'elgg';
$CONFIG->dbhost = 'localhost';
$CONFIG->dbprefix = ''; // or anything else you like
Installing Elgg
Installation will be quite easy if you follow all the steps provided in this guide. Open the browser and move on to your IP address (‘128.199.246.37’, etc.) or /install.php
of your website(‘example.com’, etc.)
http://example.com/install.php
or
http://128.199.246.37/install.php
This is it! You will be able to see the installation page alongwith instructions pertaining todifferent steps that are involved in this process. Elgg will be creating the database and will be asking for some details specific to the site and it will also create the admin user for you in the steps that follow.
Getting Help
There is great community support with Elgg. In case you get stuck anywhere just go to the community site. A number of people are there who will be ready to provide you with everything you need.