Science and technology

Build a personal social community with a Raspberry Pi

Social networks have revolutionized individuals’s lives within the final a number of years. People use social channels daily to remain related with family and friends. But a standard query stays relating to privateness and knowledge safety. Even if social networks have created advanced privateness insurance policies to guard customers, sustaining your knowledge in your personal server is at all times the most suitable choice when you do not need to make them obtainable to the general public.

Again, a Raspberry Pi—Raspbian Lite model might be very versatile that can assist you put quite a few helpful house companies (see additionally my Raspberry Pi projects article) in place. Some addictive options might be achieved by looking for open supply software program and testing it with this improbable gadget. An fascinating instance to attempt is putting in OpenSource Social Network in your Raspberry Pi.

What Is OpenSource Social Network?

OpenSource Social Network (OSSN) is a rapid-development social networking software program written in PHP, that primarily permits you to make a social networking web site. OSSN can be utilized to construct several types of social apps, equivalent to:

  • Private Intranets
  • Public/Open Networks
  • Community

OSSN helps options like:

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

OSSN runs on a LAMP server. It has very poor necessities, however a tremendous person interface, which is additionally mobile-friendly.

What we’d like

This challenge may be very easy and, as a result of we’re putting in solely distant net companies, we solely want a couple of low cost components. I’ll use a Raspberry Pi Three mannequin B+, however it ought to additionally work with Raspberry Pi Three mannequin A+ or newer boards.

Hardware:

  • Raspberry Pi Three mannequin B+ with its energy provide
  • a micro SD card (higher if it’s a performing card, a minimum of 16GB)
  • a Desktop PC with an SFTP software program (for instance, the free Filezilla) to switch set up packages into your RPI.

Step-by-step process

We’ll begin by organising a basic LAMP server. We’ll then arrange database customers and set up OpenSource Social Network.

1. Install Raspbian Buster Lite OS

For this step, you’ll be able to merely observe my Install Raspbian Buster Lite in your Raspberry Pi article.

Make positive that your system is updated. Connect through ssh terminal and kind following instructions:

sudo apt-get replace
sudo apt-get improve

2. Install LAMP server

LAMP (Linux–Apache–Mysql–Php) servers normally include the MySQL database. In our challenge, we’ll use MariaDB as an alternative, as a result of it’s lighter and works with Raspberry Pi. 

Three. Install Apache server:

sudo apt-get set up apache2 -y

You ought to now have the ability to examine that Apache set up has gone appropriately by searching http://<<YouRpiIPAddress>>:

four. Install PHP:

sudo apt-get set up php -y

5. Install MariaDB server and PHP connector:

sudo apt-get set up mariadb-server php-mysql -y

6. Install PhpMyAdmin:

PhpMyAdmin shouldn’t be obligatory in OpenSource Social Network, however I counsel that you simply set up it as a result of it simplifies database administration.

sudo apt-get set up phpmyadmin

In the phpMyAdmin setup display screen, take the next steps:

  • Select apache (obligatory) with house and press OK.
  • Select Yes to configure the database for phpMyAdmin with dbconfig-common.
  • Enter your favourite phpMyAdmin password and press OK.
  • Enter your phpMyAdmin password once more to substantiate and press OK

7. Grant phpMyAdmin person DB privileges to handle DBs:

We’ll connect with MariaDB with root person (default password is empty) to grant permissions. Remember to make use of semicolons on the finish of every command row as proven beneath:

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

eight. Finally, restart Apache service:

sudo systemctl restart apache2.service

And examine that phpMyAdmin is working by searching http://<<YouRpiIPAddress>>/phpmyadmin/. 

Default phpMyAdmin login credentials are:

  • person: phpmyadmin
  • password: the one you arrange within the phpMyAdmin set up step

Installing different open supply social network-required packages and organising PHP

We want to organize our system for OpenSource Social Network’s first setup wizard. Required packages are:

  • PHP model any of 5.6, 7.zero, 7.1
  • MYSQL 5 OR >
  • APACHE
  • MOD_REWRITE
  • PHP Extensions cURL & Mcrypt ought to be enabled
  • PHP GD Extension
  • PHP ZIP Extension
  • PHP settings allow_url_fopen enabled
  • PHP JSON Support
  • PHP XML Support
  • PHP OpenSSL

So we’ll set up them with following terminal instructions:

sudo apt-get set up php7.Three-curl php7.Three-gd php7.Three-zip php7.Three-json php7.Three-xml

1. Enable MOD_REWRITE:

sudo a2enmod rewrite

2. Edit default Apache config to make use of mod_rewrite:

sudo nano /and many others/apache2/sites-available/000-default.conf

Three. Add the part in order that your 000-default.conf file seems like the next (excluding feedback):

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

four. Install Mcrypt:

sudo apt set up php-dev libmcrypt-dev php-pear
sudo pecl channel-update pecl.php.web
sudo pecl set up mcrypt-1.zero.2

5. Enable Mcrypt module by including (or uncommenting) “extension=mcrypt.so” in “/and many others/php/7.Three/apache2/php.ini”:

sudo nano /and many others/php/7.Three/apache2/php.ini

allow_url_fopen ought to be already enabled in “/etc/php/7.3/apache2/php.ini”. OpenSSL ought to be already put in in php7.Three.

6. Another setting that I counsel is modifying the PHP max add file measurement as much as 16 MB:

sudo nano /and many others/php/7.Three/apache2/php.ini

7. Look for the row with the upload_max_filesize parameter and set it as the next:

upload_max_filesize = 16M

eight. Save and exit. Restart Apache:

sudo systemctl restart apache2.service

Install OSSN

1. Create DB and arrange person:

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

User: phpmyadmin

Password: the one arrange in phpmyadmin set up step

Click on database tab:

Create a database and be aware of the database identify, as you may be required to enter it later within the set up course of.

It’s time to create a database person for OSSN. In this instance, I will use the next credentials:

User: ossn_db_user

Password: ossn_db_password

So, terminal instructions will probably be (root password remains to be empty, if not modified by you earlier than):

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;
stop

2. Install OSSN software program:

Download the OSSN set up zip file from the OSSN download page in your native PC. At the time of this writing, this file is called “ossn-v5.2-1577836800.zip.”

Using your favourite SFTP software program, switch your complete zip file through SFTP to a brand new folder within the path “/home/pi/download” in your Raspberry Pi. Common (default) SFP connection parameters are:

  • Host: your Raspberry Pi IP deal with
  • User: pi
  • Password: raspberry (when you did not change the pi default password)
  • Port: 22

Back to terminal:

cd /house/pi/obtain/ #Enter listing the place OSSN set up information have been transferred
unzip ossn-v5.2-1577836800.zip #Extracts all information from zip
cd /var/www/html/ #Enter Apache net listing
sudo rm index.html #Removes Apache default web page - we'll use OSSN one
sudo cp -R /house/pi/obtain/ossn-v5.2-1577836800/* ./ #Copy set up information to net listing
sudo chown -R www-data:www-data ./

Create an information folder:OSSN requires a folder to retailer knowledge. OSSN suggests, for safety causes, to create this folder outdoors of the printed doc root. So, we’ll create this opt-in folder and provides grants:

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

Browse http://<<YourRpiIPAddress>> to start out the set up wizard:

All checks ought to be fantastic. Click the Next button on the finish of the web page.

Read the license validation and click on the Next button on the finish of the web page to simply accept.

Enter the database person, password, and the DB identify you selected. Remember additionally to enter the OSSN knowledge folder. Press Install.

Enter your admin account data and press the Create button.

Everything ought to be fantastic now. Press Finish to entry the administration dashboard.

So, administration panel might be reached with URL “http://<<YourRpiIPAddress>>/administrator” whereas person hyperlink will probably be “http://<<YourRpiIPAddress>>”.

This article was initially printed at peppe8o.com. Reposted with permission.

Most Popular

To Top