Run Your Own Social Network Using elgg on RHEL / CentOS and Scientific Linux

Run Your Own Social Network Using elgg on RHEL / CentOS and Scientific Linux

Elgg is an open-source and powerful social networking engine used to create your own social networking web site. In this How To, I am gonna show you how to build your own social network website, just like Facebook and Linkedin.



Elgg needs Apache, MySQL and PHP modules in order to build a social networking websites. So let us install the following necessary prerequisites first:

[root@server ~]# yum install mysql mysql-server httpd php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring wget unzip -y

Open the Apache main configuration file and change from AllowOverride None to AllowOverride All:

[root@server ~]# vi /etc/httpd/conf/httpd.conf
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
AllowOverride All

Start/Restart MySQL and Apache services now:

[root@server ~]# /etc/init.d/mysqld restart
[root@server ~]# /etc/init.d/httpd restart

Create MySQL Database for elgg

Create a database for elgg called elggdb and database user called elgg with password ‘centos’:

[root@server ~]# mysql -u root -p
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.69 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database elggdb;
Query OK, 1 row affected (0.02 sec)
mysql> create user 'elgg'@'localhost' identified by 'centos';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON elggdb.* to 'elgg' IDENTIFIED BY 'centos';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> exit

Downloading elgg

[root@server ~]# wget

Extract the downloaded file:

[root@server ~]# unzip

Move the elgg folder to Apache root document directory:

[root@server ~]# mv elgg-1.8.15/ /var/www/html/elgg

Now go to /var/www/html/elgg/engine directory and copy the file settings.example.php to settings.php:

[root@server ~]# cd /var/www/html/elgg/engine/
[root@server engine]# cp settings.example.php settings.php

Open the file settings.php and enter the details of database name, database user, database password, hostname and database prefix as shown below:

[root@server engine]# vi settings.php 
 * The database username
 * @global string $CONFIG->dbuser
 * @name $CONFIG->dbuser
$CONFIG->dbuser = 'elgg';
 * The database password
 * @global string $CONFIG->dbpass
$CONFIG->dbpass = 'centos';
 * The database name
 * @global string $CONFIG->dbname
$CONFIG->dbname = 'elggdb';
 * The database host.
 * For most installations, this is 'localhost'
 * @global string $CONFIG->dbhost
$CONFIG->dbhost = 'localhost';
 * The database prefix
 * This prefix will be appended to all Elgg tables.  If you're sharing
 * a database with other applications, use a database prefix to namespace tables
 * in order to avoid table name collisions.
 * @global string $CONFIG->dbprefix
$CONFIG->dbprefix = 'elgg_';

Create directory called data to upload photos, videos and profile icons etc. The directory should be created outside of the Apache root document folder for security reasons:

[root@server html]# mkdir data
[root@server html]# chmod 777 data/

Adjusting firewall and SELinux

Open the Apache default port 80 through your firewall/router and disable the SELinux:

[root@server html]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
-A INPUT -p udp -m state --state NEW --dport 3306 -j ACCEPT
-A INPUT -p tcp -m state --state NEW --dport 3306 -j ACCEPT
-A INPUT -p udp -m state --state NEW --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT
-A INPUT -p udp -m state --state NEW --dport 53 -j ACCEPT
-A INPUT -p tcp -m state --state NEW --dport 53 -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited

Restart the iptables to save the changes:

[root@server html]# /etc/init.d/iptables restart

Disable SELinux and reboot your system:

[root@server ~]# vi /etc/sysconfig/selinux 
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.

Starting elgg installation

Open the web browser and navigate to http://ip-address/elgg/install.php or http://domain-name/elgg/install.php. Follow the on screen instructions:

Elgg Install : Welcome - Mozilla Firefox_001

You may get an error like in the below screen-shot.

Elgg Install : Requirements check - Mozilla Firefox_002

To get rid of this error, open the file .htaccess in the elgg directory and edit as follows. If .htaccess file doesn’t exist, create it by copying the htaccess_dist file in the elgg directory to .htaccess.

[root@server ~]# vi /etc/httpd/conf/httpd.conf 
[root@server ~]# cd /var/www/html/elgg/
[root@server elgg]# cp htaccess_dist .htaccess

Now open the .htaccess file in any editor. Uncomment the line 94 and set it as shown below:

[root@server elgg]# vi .htaccess 
## Line no 94 - Uncomment and set as below ##
RewriteBase /elgg/

Save and exit the file. Restart the httpd service and try again the installer. This time the error will be gone.

Elgg Install : Requirements check - Mozilla Firefox_003

Now enter the Site Name, Site Administrator email ID and data directory path as shown below. Click Next.

Elgg Install : Configure site - Mozilla Firefox_004

Now create the Admin account for elgg. Fill up details and click Next.

Elgg Install : Create admin account - Mozilla Firefox_006

Now your new social network has been created. Click Go to site to get started.

Elgg Install : Finished - Mozilla Firefox_007

This is how your Administration Dashboard will appear.

Unixmen Community: Dashboard - Mozilla Firefox_008

Click on the View Site link on the upper right corner of Dashboard page. This is how your home page of your social network website will appear.

Unixmen Community: All Site Activity - Mozilla Firefox_009

From here, the users can create new blogs, pages, files, groups and so on.

  • The Joker

    Is it better than Friendika?

  • Brig C. McCoy

    Thanks for the walkthrough, it worked great the first try… now I’m off to read the manual so I can be ready when I start adding staff to it. :)

  • SK

    Never heard about Friendica. Let me try and I’ll make an article accordingly.

  • Brig C. McCoy

    Oops, forgot to say I had to install php-mbstring to make it happy. Once I did that, all bueno. :)

  • SK

    Thanks for the tip Brig. Post has been updated. Glad it helped you.

  • Etescartz

    Hi! I stumbled on this article and I really want to try elgg on a ubuntu server, but I’m at a standstill . I’m a newbie when it comes to linux and I tried installing the packages mentioned in the article, but the must be different in the Ubuntu repositories.. Any help would be greatly appreciated.

  • amerykańska kuchnia

    Taki plan jest niezbędny by rozpocząć procedurę
    zalesiania terenu oraz do uzyskania wszelkich dopłat z Unii Europejskiej.

  • Ustanowienie opieki

    W zarządzeniu spośród dnia 9 lipca 2009 r.

    (sygn. część III CZP 47/09) Głos Król niebios sprawdziłby, iż jeżeli – jak w stanie naturalnym rzeczonej kwestii
    – szwank uległa popełniona dzięki woli niedrogiej lub niewłaściwej
    z uprawnieniem, jaka stała się bezdyskusyjna zanim 1 września 2004
    r., toż definitywna uchwała nadzorcza uległa oddana po niniejszej dacie,
    owo do wynagrodzenia zaległego poszkodowanemu ex delicto aplikować się będzie
    przepisy regulacji spośród 2004 r., i więc inny
    przepis obywatelski, w szczególności art. 4171 § 2 KC.

  • Visum turkije online

    Hi there i am kavin, its my first time to commenting anywhere, when i read this piece
    of writing i thought i could also create comment due to
    this good paragraph.

  • Uzytkowanie

    W implikacji pomiędzy stratą zarządzenia aż do intrygi, zaś stratą
    prowizji zachodzi stereotypowy (dobry) sojusz przyczynowy,
    obok czym zryw podlegającej zaradzeniu straty zastrzegane jest wystąpieniem
    zdarzeń określonych w regulaminie jednostek niemerkantylnych (przede całkowitym przeznaczeniem osiągniętego
    zarobku firmy aż do rozłamu pośrodku udziałowców).
    po dokonaniu daniny prowizji w środku dany dwanaście miesięcy kalendarzowy
    niespolegliwa zaś niepodlegająca naprawieniu szwank nadeszłaby przeradza się w
    krzywdę domniemaną w tym znaczeniu, że modułem niespolegliwym (hipotetycznym), odkąd jakiego zależy funkcja zniwelowania psoty, jest jarzmo rannego potwierdzaniem, iż stanowiłby posiadaczem straconych imprezy
    (trzymał je) w dniu dywidendy. Niebieżąca okazja
    musi istnieć akceptowana z adekwatnym (przemyślanym) prawdopodobieństwem, spośród zaliczeniem
    sprecyzowanych wyżej okoliczności (np.
    zachowania poszkodowanego po zdarzeniu powodującym krzywdę, upływu terminu itp.).
    Należy także brać pod uwagę rozpoznawalne stosunki należące nieodpłatnego upowszechniania czynności pracobiorcom, takie gdy bycie okresu wyłączenia operacji z
    piruetu, jednakowoż ustalanych w poszukiwaniach uczonych (por.