How to Install Open Source Social Network (OSSN) on Ubuntu 26.04
Install the current Open Source Social Network release on Ubuntu 26.04 LTS with Apache, PHP and MySQL, then finish the setup in the web installer.
Open Source Social Network (OSSN) is a PHP application for running your own social network with profiles, friends, groups, photos, messaging and a news feed. This guide installs the current OSSN release on Ubuntu 26.04 LTS with Apache, PHP and MySQL from the Ubuntu repositories. The same steps work on Ubuntu 24.04 LTS; the differences are noted where they matter. At the end you will have a working site with an administrator account.
Requirements
The OSSN project lists these requirements for the current release:
- PHP 8.x with the cURL, GD, ZIP, JSON, XML, mbstring, MySQLi and OpenSSL extensions, and
allow_url_fopenswitched on - MySQL 8 or later
- Apache with
mod_rewriteenabled - For a self-hosted site, roughly 1 GB of RAM, one CPU core and 10 GB of disk as a starting point
Ubuntu 26.04 ships PHP 8.5 and MySQL 8.4, and Ubuntu 24.04 ships PHP 8.3 and MySQL 8.0, so both meet these requirements without extra repositories. You also need a user with sudo rights and a domain name pointing to the server; the examples use example.com.
Step 1: Install Apache, PHP and MySQL
Update the package index and install the web server, the database server and the PHP extensions OSSN needs. JSON and OpenSSL support are built into Ubuntu's PHP packages and need no separate package.
sudo apt update
sudo apt install apache2 mysql-server libapache2-mod-php php-mysql php-curl php-gd php-zip php-xml php-mbstring unzip
Enable the rewrite module, which OSSN uses for its URLs:
sudo a2enmod rewrite
allow_url_fopen is on in PHP's default configuration. Confirm it with:
php -i | grep allow_url_fopen
Step 2: Create the database
Open the MySQL shell as the administrative user:
sudo mysql
Create a database and a user that owns it. Replace the password with one of your own.
CREATE DATABASE ossn CHARACTER SET utf8mb4;
CREATE USER 'ossn'@'localhost' IDENTIFIED BY 'choose-a-strong-password';
GRANT ALL PRIVILEGES ON ossn.* TO 'ossn'@'localhost';
EXIT;
Step 3: Download OSSN
Download the latest build from the project's site and unpack it into /var/www:
cd /tmp
wget -O ossn.zip https://www.opensource-socialnetwork.org/download_ossn/latest/build.zip
sudo unzip ossn.zip -d /var/www/
List the result to see the name of the directory that was created. The rest of this guide assumes it is /var/www/ossn; adjust the paths if yours differs.
ls /var/www
Step 4: Create the data directory and set permissions
OSSN stores uploaded files such as profile pictures and photos in a separate data directory. The project is explicit that this directory must be outside the web server's document root, so that uploads cannot be requested directly. The web server needs to write to it and to the application directory.
sudo mkdir /var/www/ossn_data
sudo chown -R www-data:www-data /var/www/ossn /var/www/ossn_data
Step 5: Configure the Apache virtual host
Create a site configuration:
sudo nano /etc/apache2/sites-available/ossn.conf
Add the following. AllowOverride All lets Apache apply the rewrite rules in the .htaccess file that ships with OSSN.
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/ossn
<Directory /var/www/ossn>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/ossn_error.log
CustomLog ${APACHE_LOG_DIR}/ossn_access.log combined
</VirtualHost>
Enable the site, disable the default one, test the configuration and restart Apache:
sudo a2ensite ossn.conf
sudo a2dissite 000-default.conf
sudo apachectl configtest
sudo systemctl restart apache2
If the firewall is active, allow web traffic:
sudo ufw allow "Apache Full"
Add a TLS certificate before you let people sign up, because the site handles passwords and private messages. With Certbot's Apache plugin that is sudo apt install certbot python3-certbot-apache followed by sudo certbot --apache -d example.com. Do this before running the installer so that OSSN records the https:// address as its site URL.
Step 6: Run the web installer
Open https://example.com in a browser. The installer first checks the requirements; if it reports a missing extension, install the matching php- package, restart Apache and reload the page. Then enter:
- the database name
ossn, the userossn, the password from step 2 and the hostlocalhost - the site name and the site URL
- the data directory,
/var/www/ossn_data/ - the details of the first account, which becomes the administrator
When the installer finishes, log in with the administrator account and open the administration panel to set the site's basic options and enable or disable components.
Verify and maintain
Create a second, normal account, post something and upload a profile picture. If the upload works, the data directory permissions are right. If pages other than the home page return a 404 error, the rewrite rules are not being applied: check that mod_rewrite is enabled and that AllowOverride All is set for the correct directory.
Back up three things regularly: the application directory, the data directory and the database.
sudo mysqldump ossn | gzip > ossn-$(date +%F).sql.gz
sudo tar czf ossn-files-$(date +%F).tar.gz /var/www/ossn /var/www/ossn_data
To upgrade to a newer OSSN release, the project's procedure is: take those backups, log in to the administrator dashboard and keep that session open, disable caching, copy the files of the new release over the existing installation, make sure they are still owned by the web server user, and then open https://example.com/upgrade/upgrade.php.
Frequently asked questions
Can I use MariaDB or Nginx instead?
The project's requirements name MySQL and Apache with mod_rewrite, and the application ships its rewrite rules as an Apache .htaccess file. Other combinations mean translating those rules and working outside what the project documents, so stay with Apache and MySQL unless you have a reason not to.
Is there a package or container instead of a manual install?
Yes. The OSSN repository points to a Launchpad PPA for supported Ubuntu LTS releases (ppa:arsalanshah/opensource-socialnetwork, package opensource-socialnetwork), a Docker setup and a ready-made virtual machine image. The manual install above keeps you in control of where files live and how updates are applied.
Why must the data directory be outside the document root?
Everything under the document root can be requested by URL. Keeping uploads elsewhere means files are only served through OSSN, which can check who is allowed to see them, and an uploaded file can never be executed as a script by the web server.
Under which licence is OSSN released?
The free version is published under the Open Source Social Network License, which is based on the Cryptographic Autonomy License 1.0. Read it before you modify or redistribute the software; premium components are sold separately by the project.