Ricerca nel sito web

Come installare la piattaforma di social network Friendica su Ubuntu 20.04


Su questa pagina

  1. Prerequisiti
  2. Per iniziare
  3. Installa il server LAMP
  4. Crea un database Friendica
  5. Scarica Friendica
  6. Configura Apache per Friendica
  7. Accedi alla dashboard di Friendica
  8. Proteggi Friendica con Lets Encrypt SSL
  9. Conclusione

Friendica è una piattaforma di social networking gratuita, open source e decentralizzata che ti aiuta a costruire e mantenere i tuoi progetti di social networking. Ha il supporto integrato per ActivityPub inclusi, Mastodon, Hubzilla, OStatus, Pleroma e altro. Ti consente di importare i tuoi siti Web e blog nel tuo flusso sociale tramite feed RSS/Atom. Fornisce una potente dashboard per utenti e amministratori che ti aiuta a gestire il tuo social network da qualsiasi dispositivo.

In questo tutorial, ti mostreremo come installare Friendica con Apache e Lets Encrypt SSL su Ubuntu 20.04.

Prerequisiti

  • Un server che esegue Ubuntu 20.04.
  • Un nome di dominio valido indicato con l'IP del tuo server.
  • Il server è configurato con una password di root.

Iniziare

Prima di iniziare, dovrai aggiornare i tuoi pacchetti di sistema all'ultima versione. Puoi aggiornarli usando il seguente comando:

apt-get update -y

Una volta aggiornato il server, puoi procedere al passaggio successivo.

Installa LAMP Server

Friendica funziona su un server web, scritto in PHP e utilizza MySQL come backend del database. Quindi lo stack LAMP deve essere installato nel tuo sistema. Se non è installato, puoi installarlo con il seguente comando:

apt-get install apache2 mariadb-server php libapache2-mod-php php-common php-gmp php-curl php-intl php-mbstring php-xmlrpc php-mysql php-gd php-imagick php-xml php-cli php-zip php-sqlite3 curl git -y

Una volta installati tutti i pacchetti, modifica il file php.ini e apporta alcune modifiche:

nano /etc/php/7.4/apache2/php.ini

Modifica le seguenti righe:

memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 300
max_input_vars = 1500
date.timezone = Asia/Kolkata

Salva e chiudi il file quando hai finito.

Crea un database Friendica

Successivamente, dovrai creare un database e un utente per Friendica. Innanzitutto, connettiti a MySQL con il seguente comando:

mysql

Una volta connesso, crea un database e un utente con il seguente comando:

MariaDB [(none)]> CREATE DATABASE friendicadb;
MariaDB [(none)]> CREATE USER 'friendica'@'localhost' IDENTIFIED BY 'password';

Successivamente, concedi tutti i privilegi al database di Friendica con il seguente comando:

MariaDB [(none)]> GRANT ALL ON friendicadb.* TO 'friendica'@'localhost' WITH GRANT OPTION;

Successivamente, scarica i privilegi ed esci da MySQL con il seguente comando:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Una volta terminato, puoi procedere al passaggio successivo.

Scarica Amica

Prima di scaricare Friendica, dovrai installare Composer nel tuo sistema. Puoi installarlo con il seguente comando:

apt-get install composer -y

Una volta installato, cambia la directory in Apache web root e scarica l'ultima versione di Friendica dal repository Git:

cd /var/www/html
git clone https://github.com/friendica/friendica.git

Una volta completato il download, cambia la directory in friendica e installa le dipendenze PHP richieste con il seguente comando:

cd friendica
composer install --no-dev

Successivamente, scarica i componenti aggiuntivi di Friendica con il seguente comando:

git clone https://github.com/friendica/friendica-addons.git

Successivamente, imposta la proprietà e l'autorizzazione corrette per la directory friendica:

chown -R www-data:www-data /var/www/html/friendica/
chmod -R 755 /var/www/html/friendica/

Una volta terminato, puoi procedere al passaggio successivo.

Configura Apache per Friendica

Successivamente, dovrai creare un file di configurazione dell'host virtuale Apache per ospitare Friendica. Puoi crearlo con il seguente comando:

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

Aggiungi le seguenti righe:

<VirtualHost *:80>
     ServerAdmin 
     DocumentRoot /var/www/html/friendica
     ServerName friendica.example.com


     <Directory /var/www/html/friendica/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Salvare e chiudere il file quindi abilitare l'host virtuale Apache e il modulo di riscrittura con il seguente comando:

a2ensite friendica.conf
a2enmod rewrite

Successivamente, ricarica il servizio Apache per applicare le modifiche:

systemctl restart apache2

Puoi verificare lo stato del servizio Apache con il seguente comando:

systemctl status apache2

Dovresti ottenere il seguente output:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2021-02-07 09:20:58 UTC; 6s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 33243 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 33259 (apache2)
      Tasks: 6 (limit: 2353)
     Memory: 15.1M
     CGroup: /system.slice/apache2.service
             ??33259 /usr/sbin/apache2 -k start
             ??33260 /usr/sbin/apache2 -k start
             ??33261 /usr/sbin/apache2 -k start
             ??33262 /usr/sbin/apache2 -k start
             ??33263 /usr/sbin/apache2 -k start
             ??33264 /usr/sbin/apache2 -k start

Feb 07 09:20:58 ubunt4 systemd[1]: Starting The Apache HTTP Server...

Accedi alla dashboard di Friendica

Ora apri il browser web e accedi all'interfaccia web di Friendica utilizzando l'URL http://friendica.example.com. Verrai reindirizzato alla pagina di controllo del sistema:

Assicurati che tutte le dipendenze PHP siano installate, quindi fai clic sul pulsante Avanti. Dovresti vedere la seguente pagina:

Fornisci il tuo nome di dominio, il percorso di installazione e fai clic sul pulsante Invia. Dovresti vedere la seguente pagina:

Fornire il nome del database, il nome utente del database, la password e fare clic su Invia. Dovresti vedere la pagina delle impostazioni del sito:

Fornisci l'e-mail dell'amministratore, la lingua, il fuso orario e fai clic sul pulsante Invia. Una volta completata l'installazione, dovresti vedere la seguente pagina:

Ora, fai clic sul pulsante della pagina di registrazione e completa il processo di registrazione per accedere ad Friendica.

Proteggi Friendica con Lets Encrypt SSL

È sempre una buona idea proteggere il tuo sito web con Lets Encrypt SSL. Dovrai installare il client Certbot per installare e gestire SSL. Puoi installarlo con il seguente comando:

apt-get install python3-certbot-apache -y

Una volta installato Certbot, esegui il seguente comando per proteggere il tuo sito web con Lets Encrypt SSL:

certbot --apache -d friendica.example.com

Ti verrà chiesto di fornire la tua email e di accettare i termini di servizio come mostrato di seguito:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for friendica.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/friendica-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/friendica-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/friendica-le-ssl.conf

Successivamente, seleziona se reindirizzare o meno il traffico HTTP su HTTPS come mostrato di seguito:

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

Digita 2 e premi Invio per installare Lets Encrypt SSL per il tuo sito web:

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/friendica.conf to ssl vhost in /etc/apache2/sites-available/friendica-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://friendica.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=friendica.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/friendica.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/friendica.example.com/privkey.pem
   Your cert will expire on 2020-10-23. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

Ora puoi accedere al tuo sito Web in modo sicuro utilizzando l'URL https://friendica.example.com.

Conclusione

Congratulazioni! hai installato e configurato correttamente la piattaforma di social network Friendica sul server Ubuntu 20.04. Ora puoi gestire la tua community di social network dalla posizione centrale.