Categories Tutorials

Install Open Source Social Network on Ubuntu 16.04

In this tutorial, we are going to provide you with step by step instructions on how to install Open Source Social Network with Apache on an Ubuntu 16.04 VPS.
Open Source Social Network (OSSN) is a social networking software written in PHP used by website developers to create social networking websites. The installation process is easy and it takes only a couple of minutes.

At the time of writing this tutorial, the latest stable version of Open Source Social Network is 4.2 and it requires:

  • PHP 5.4 or higher (preferably the latest), compiled with cURL, mcrypt, MySQLi, ZIP, JSON, XML PHP extensions and GD PHP Library enabled.
  • allow_url_fopen option enabled in PHP
  • Apache Web Server 2.0 or higher compiled with mod_rewrite module;

This install guide assumes that Apache is already installed and configured on your virtual server.

Let’s start with the installation. Make sure your server OS packages are fully up-to-date:

apt-get update 
apt-get upgrade

Enable Apache rewrite module if it is not already done so:

a2enmod rewrite

Install required PHP packages:

apt-get install php7.0-cli php7.0-common php7.0-json php7.0-mcrypt php7.0-mysql php7.0-xml php7.0-curl php7.0-zip php7.0-gd

Restart the Apache service for the changes to take effect:

service apache2 restart

Download the latest version of Open Source Social Network available at http://www.opensource-socialnetwork.org/download to a directory on the server and extract it using the following commands:

cd /opt/
wget https://www.opensource-socialnetwork.org/downloads/ossn-v4.2-1468404691.zip -O ossn.zip
unzip ossn.zip -d /var/www/html/

Create a new MySQL database and user for OSSN:

mysql -u root -p
mysql> SET GLOBAL sql_mode='';
mysql> CREATE DATABASE ossndb;
mysql> CREATE USER 'ossnuser'@'localhost' IDENTIFIED BY 'y0ur-pAssW0RD';
mysql> GRANT ALL PRIVILEGES ON ossndb.* TO 'ossnuser'@'localhost';
mysql> quit

Do not forget to replace ‘y0ur-pAssW0RD’ with a strong password.

Edit the PHP configuration file (/etc/php/7.0/cli/php.ini):

vi /etc/php/7.0/cli/php.ini

and modify these lines:

allow_url_fopen = On
file_uploads = On
upload_max_filesize = 32M

OSSN needs a directory for storing the uploaded files such as images. For security reasons we will create this directory outside of the document root directory:

mkdir -p /var/www/ossndatadir

All files have to be readable by the web server, so set a proper ownership:

chown www-data:www-data -R /var/www/html/ossn/

Create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘ossn.conf’ on your virtual server:

touch /etc/apache2/sites-available/ossn.conf
ln -s /etc/apache2/sites-available/ossn.conf /etc/apache2/sites-enabled/ossn.conf
vi /etc/apache2/sites-available/ossn.conf

Then, add the following lines:

<VirtualHost *:80>
ServerAdmin admin@your-domain.com
DocumentRoot /var/www/html/ossn/
ServerName your-domain.com
ServerAlias www.your-domain.com
<Directory /var/www/html/ossn/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
ErrorLog /var/log/apache2/your-domain.com-error_log
CustomLog /var/log/apache2/your-domain.com-access_log common

Remove the 000-default.conf file:

rm /etc/apache2/sites-enabled/000-default.conf

Restart the Apache web server for the changes to take effect:

service apache2 restart

Open your favorite web browser, navigate to http://your-domain.com/ , verify that all installation prerequisites are met and the OSSN installer should be starting. You should follow the easy instructions on the install screen inserting the necessary information as requested. Do not forget to set data directory to ‘/var/www/ossndatadir’.

That is it. The Open Source Social Network has been installed on your server.

Log in to the OSSN administration back-end at http://your-domain.com/administrator and configure OSSN according to your needs.


Of course, you don’t have to do any of this if you use one of our OSSN VPS Hosting services, in which case you can simply ask our expert Linux admins to install Open Source Social Network for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.


View Comments

  • Hi, Thanks for this tutorial. Sadly I am using the free version and after some dabbling I saw that ossn doesn't seem to detect mod_rewrite accurately, and there is no /administrator directory.

    • Apache mod_rewrite is required for OSSN to work, so enable Apache rewrite module using: a2enmod rewrite

  • OSSN's Documentation states that in cases where you believe mod_rewrite is not being detected correctly, you can bypass it through the installation directory. I had run into the issue when using httpd24 instead of apache2. website.com/installation/?page=settings See: https://www.opensource-socialnetwork.org/wiki/view/709/apache-mod-rewrite I believe there was one missed step (or the wrong directory) in this SbS. www-data requires access to the data directory you create to store photos in. After creating the ossndatadir, you need to chown on it. chown www-data:www-data -R /var/www/ossndatadir/ I had failed photo uploads until I did that, then photos worked.