Private Social Network with Raspberry Pi and OpenSource Social Network


Social networks spread everywhere, covering everyone life. But they are owned from companies, so you can be concerned about your privacy. With OpenSource Social Network (OSSN) you can create your own private one with a Raspberry PI and keep your data ownership.

In this tutorial I’m going to show you how to install OpenSource Social Network in a Raspberry PI.

Social Networks revolutionized people life in last years. Everyone uses its social channels everyday to stay connected with friends and family. But a common question regards privacy and data security, which are shared with all world. Even if Social Networks created complex privacy policies to protect users, maintaining your data in your server is always the best option if you don’t want to make them available to public.

Again, Raspberry PI with its Lite OS distribution can be very versatile to put in place a number of home useful services (see also my Raspberry Pi projects article). Some addicting features can be achieved by searching open source software and testing it with this fantastic device. An interesting example is installing OpenSource Social Network in your Raspberry PI.

For this project I’m going to use a Raspberry PI 3 model B, but this will work also on other Raspberry PI boards.

What Is OpenSource Social Network

OpenSource Social Network is “a rapid development social networking software written in PHP. It allows you to make a social networking website.
Ossn can be used to build different types of social apps.

  • Private Intranets
  • Public/Open Networks
  • Community


  • Photos
  • Profile
  • Friends
  • Smileys
  • Search
  • Chat”

It runs on a LAMP server. Has very poor hardware requirements and an amazing user interface. Its interface is also mobile friendly.

What We Need

As usual, I suggest adding from now to your favourite e-commerce shopping cart all needed hardware, so that at the end you will be able to evaluate overall costs and decide if continue with the project or remove them from the shopping cart. So, hardware will be only:

Raspberry PI 3 Model B+ image

You will also need a Desktop PC with an SFTP software (like, for example, the free Filezilla) to transfer installation packages into your RPI.

Check hardware prices with following links:

Amazon raspberry pi boards box
Amazon raspberry pi Zero W box
Amazon Micro SD box
Amazon Raspberry PI Power Supply box

Step-By-Step procedure

We’ll start from setting up a classic LAMP server. We’ll then setup database users and install OpenSource Social Network.

Prepare OS

Start from your operating system. I suggest to install Raspberry PI OS Lite (for a fast, headless environment), as done for this article. You can also use Raspberry PI OS Desktop, in this case using its internal terminal.

Make sure that your system is up to date. Connect via ssh terminal and type following command:

sudo apt update -y && sudo apt upgrade -y

Install LAMP Server

LAMP (Linux – Apache – Mysql – Php) servers usually comes with MySQL database. In our project we’ll use instead MariaDB because it is lighter and work fine with Raspberry Pi. I’ll go fast in this first part because installin a LAMP server is well documented over internet…

Install Apache Server:
sudo apt install apache2 -y

You should now be able to check that Apache installation has gone correctly by browsing http://<<YouRpiIPAddress>>:

Apache2 default page
Install PhP:

From terminal, use following command:

sudo apt install php -y
Install MariaDB Server and php connector:

Following commands will do the job:

sudo apt install mariadb-server php-mysql -y
Install PhpMyAdmin:

PhpMyAdmin is not mandatory in OpenSource Social Network, but I suggest to install it because simplifies databases management.

sudo apt install phpmyadmin

In phpmyadmin setup screens I suggest the following:

  • select apache (mandatory) with space and press Ok
  • select Yes to configure database for phpmyadmin with dbconfig-common
  • insert your favourite phpmyadmin password and press Ok
  • insert again your phpmyadmin password to confirm and press Ok
Grant phpmyadmin user DB privileges to manage DBs:

We’ll connect to MariaDB with root user (defult password is empty) to grant permissions (remember to use semicolumns at the end of each command row as showed below):

sudo mysql -uroot -p
grant all privileges on *.* to 'phpmyadmin'@'localhost';
flush privileges;

Finally restart Apache service:

sudo systemctl restart apache2.service

and check that phpmyadmin is working by browsing “http://<<YouRpiIPAddress>>/phpmyadmin/”

phpmyadmin default page

Default phpmyadmin login credentials are:

  • user: phpmyadmin
  • password: the one set up in phpmyadmin installation step

Installing Other OpenSource Social Network Required Packages and Setting Up Php

We need to prepare our system to OpenSource Social Network first setup wizard. Required packages are:

  • PHP version any of 5.6, 7.0, 7.1
  • MYSQL 5 OR >
  • PHP Extensions cURL should be enabled
  • PHP GD Extension
  • PHP ZIP Extension
  • PHP settings allowurlfopen enabled
  • PHP JSON Support
  • PHP XML Support
  • PHP OpenSSL

So we’ll install them with following terminal commands:

sudo apt-get install php7.3-curl php7.3-gd php7.3-zip php7.3-json php7.3-xml


sudo a2enmod rewrite

Edit default Apache config to use mod_rewrite:

sudo nano /etc/apache2/sites-available/000-default.conf

Add the <Directory> section, so that your 000-default.conf file appears like the following (excluding comments):

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    # SECTION TO ADD --------------------------------
        <Directory /var/www/html>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
    # END SECTION TO ADD --------------------------------

allow_url_fopen should be already enablen in “/etc/php/7.3/apache2/php.ini”. Openssl should be already installed in php7.3.

Another setting that I suggest is editing php max upload file size up to 16 MB:

sudo nano /etc/php/7.3/apache2/php.ini

Look for the row with upload_max_filesize parameter and set it as the following:

upload_max_filesize = 16M

Save and exit. Restart again Apache:

sudo systemctl restart apache2.service

Install OSSN

Create DB And Setup User:

Go back to phpmyadmin web page (browse “http://<<YourRpiIPAddress>>/phpmyadmin/”) and login:

user: phpmyadmin

password: the one set up in phpmyadmin installation step

Click on Database Tab:

phpmyadmin database create 1

Create a database and take a note of the database name as you will require the same name in the further installation process.


It’s time to create a database user for OSSN. In this example I’ll use the following credentials. Use the one at you choice, mostly for password:

user: ossn_db_user

password: ossn_db_password

So, terminal commands will be (root password is still empty, if not changed by you before):

sudo mysql -uroot -p
CREATE USER 'ossn_db_user'@'localhost' IDENTIFIED BY 'ossn_db_password';
GRANT ALL PRIVILEGES ON ossn_db.* TO 'ossn_db_user'@'localhost';
flush privileges;
Install OSSN Software:

Download OSSN installation zip file from OSSN download page in your local PC. At the time of this article, this file is named “

With you favoutire SFTP software transfer via SFTP the entire zip file to a new folder in path “/home/pi/download” in your Raspberry PI. Common (default) SFP connection parameters are:

  • host: your Raspberry Pi IP address
  • user: pi
  • password: raspberry (if you didn’t changed pi default password)
  • port: 22

Back to terminal:

cd /home/pi/download/ #Enter directory where OSSN installation files have been transferred
unzip #Extracts all files from zip
cd /var/www/html/ #Enter Apache web directory
sudo rm index.html #Removes Apache default page - we'll use OSSN one
sudo cp -R /home/pi/download/ossn-v5.2-1577836800/* ./ #Copy installation files to web directory
sudo chown -R www-data:www-data ./

Create Data Folder

OSSN requires a folder to store data. OSSN suggest, for security reason, to create this folder outside from published document root. So, we’ll create this in opt folder and give grants:

sudo mkdir /opt/ossn_data
sudo chown -R www-data:www-data /opt/ossn_data/

Browse http://<<YourRpiIPAddress>> to start installation wizard:


All checks should be fine. Please click Next button at the end of page.


Read License validation and click Next button (at the end of page) to accept.


Enter Database user, password, db name you choosed. Remember also to insert OSSN data folder. Press Install.


Enter your Admin account info. Press Create button.


Everything should be fine now. Press Finish to access administration dashboard.


So, administration panel can be reached with URL “http://<<YourRpiIPAddress>>/administrator” while user link will be “http://<<YourRpiIPAddress>>”


Enjoy your OpenSource Social Network in Raspberry PI!

How useful was this post?

Click on a star to rate it anonymously!

Average rating 3 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?