Friendica Tut.

html

How to Install Friendica on Ubuntu/Debian with SSL

Prerequisites

  • Ubuntu 22.04 LTS or Debian 11/12
  • Root or sudo access
  • Domain name (e.g., social.yourdomain.com)
  • Minimum 2GB RAM (4GB recommended)

Step 1: Update System

sudo apt update && sudo apt upgrade -y

Step 2: Install Dependencies

sudo apt install -y \
    apache2 mariadb-server \
    php8.1-fpm php8.1-{curl,gd,mbstring,xml,zip,mysql,intl,ldap,json,cgi} \
    git curl unzip

Step 3: Configure PHP

sudo nano /etc/php/8.1/fpm/php.ini

Update:

post_max_size = 64M
upload_max_filesize = 64M
memory_limit = 256M
max_execution_time = 300
date.timezone = Your/Timezone

Step 4: Create Database

sudo mysql -u root -p
CREATE DATABASE friendica CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'friendica_user'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL ON friendica.* TO 'friendica_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 5: Install Friendica

cd /var/www
sudo git clone https://github.com/friendica/friendica.git friendica
cd friendica
sudo git checkout stable
sudo git submodule update --init --recursive
sudo chown -R www-data:www-data /var/www/friendica

Step 6: Configure Apache

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

Paste:

<VirtualHost *:80>
    ServerName social.yourdomain.com
    DocumentRoot /var/www/friendica

    <Directory /var/www/friendica>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/friendica_error.log
    CustomLog ${APACHE_LOG_DIR}/friendica_access.log combined
</VirtualHost>

Step 7: Enable Site

sudo a2enmod rewrite headers
sudo a2ensite friendica.conf
sudo systemctl restart apache2

Step 8: Install SSL

sudo apt install -y certbot python3-certbot-apache
sudo certbot --apache -d social.yourdomain.com

Step 9: Complete Web Installation

  1. Visit https://social.yourdomain.com
  2. Follow the wizard
  3. Database details:
    • Host: localhost
    • Database: friendica
    • Username: friendica_user
    • Password: your_secure_password

Step 10: Set Up Cron Jobs

sudo crontab -u www-data -e

Add:

*/10 * * * * cd /var/www/friendica && /usr/bin/php bin/worker.php
0    0 * * * cd /var/www/friendica && /usr/bin/php bin/expire.php

Security Hardening

sudo chmod 750 /var/www/friendica/
sudo chmod 640 /var/www/friendica/.htaccess

Maintenance

Update:

cd /var/www/friendica && sudo -u www-data git pull

Backup:

mysqldump -u root -p friendica > friendica_backup_$(date +%F).sql

Troubleshooting

Check logs:

tail -f /var/log/apache2/friendica_*.log

Verify SSL:

sudo certbot certificates

Check cron:

sudo -u www-data crontab -l

Views: 16

Xog Ops