How to Install and Configure Open Source Social Network on Ubuntu 16.04

Published on: Tue, Dec 20, 2016 at 1:33 pm EST
Linux Guides Server Apps Ubuntu Web Servers

Introduction

Open source social network also known as OSSN is a PHP based social networking tool that allows you to make your own social networking website and build relationship with members.

In this tutorial, we will explain how to install OSSN on your Ubuntu 16.04 server.

Prerequisites

  • A newly deployed Vultr Ubuntu 16.04 server instance.
  • A sudo user.

Step 1: Update The System

Before starting, you should update the system to the latest stable version with the following commands:

sudo apt-get update -y
sudo apt-get upgrade -y
sudo reboot

Step 2: Installing LAMP

In order to install OSSN, you will need to install the LAMP stack and some additional PHP modules on your server using the following commands:

sudo apt-get install apache2 libapache2-mod-php7.0 mariadb-server php7.0 php7.0-mysql php7.0-curl php7.0-gd     
php7.0-json php7.0-opcache php7.0-xml mcrypt php7.0-mcrypt php7.0-cgi php7.0-json php7-0-zip

Step 3: Installing Open Source Social Network

First you will need to download the latest stable version of OSSN from OSSN's website https://www.opensource-socialnetwork.org/download. You can download it with the wget command: wget https://www.opensource-socialnetwork.org/downloads/ossn-v4.2-1468404691.zip

Next, unzip the downloaded archive to the /var/www/html directory.

sudo unzip  ossn-v4.2-1468404691.zip -d /var/www/html

You will need to ensure the correct ownership of the ossn directory:

sudo chown -R www-data.www-data /var/www/html/ossn/

Step 4: Configuring Database for Open Source Social Network

It is recommended that you run the mysql_secure_installation command to improve MySQL’s security:

sudo mysql_secure_installation

You will be presented with a few questions to which you will need to provide an answer. Next, using the MySQL command line, create a database for OSSN:

mysql -u root -p

Enter your MySQL/MariaDB root password and hit enter. Once you are logged in, you can create a database for OSSN as follows:

 MariaDB [(none)]> SET GLOBAL sql_mode='';
 MariaDB [(none)]> CREATE DATABASE ossndb;
 MariaDB [(none)]> CREATE USER 'ossnuser'@'localhost' IDENTIFIED BY 'password-here';
 MariaDB [(none)]> GRANT ALL PRIVILEGES ON ossndb.* TO 'ossnuser'@'localhost';
 MariaDB [(none)]> FLUSH PRIVILEGES; 
 MariaDB [(none)]> \q

Step 5: Configuring Apache for OSSN

Once the database is created, you need to create a new virtual host file, e.g. ossn.conf in the Apache sites’ directory:

 sudo nano /etc/apache2/sites-available/ossn.conf

Add the following lines:

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

Once you are finished, enable virtual host by running the following commands:

 sudo a2ensite ossn.conf
 sudo  service apache2 reload

You will also need to enable rewrite module:

 sudo a2enmod rewrite

You will also need to make some PHP configuration changes by editing php.ini:

 sudo nano /etc/php/7.0/cli/php.ini

Changes the values for allow_url_fopen, file_uploads, and upload_max_filesize as shown below:

 allow_url_fopen = On
 file_uploads = On
 upload_max_filesize = 32M

Next, create a directory named data outside the document root directory for storing the uploaded files:

 sudo mkdir /var/www/ossn_data

Finally, restart Apache service to effect the changes:

 sudo systemctl restart apache2

Step 6: Accessing OSSN Web Interface

Once done, visit http://192.0.2.2 in your browser to complete all the required steps to finish your OSSN installation.

Don’t forget to replace example.com and 192.0.2.2 with your actual domain name your server’ IP addresses.

Want to contribute ?

You could earn up to $300 by adding new articles