GNU/Linux >> Linux Esercitazione >  >> Ubuntu

Come installare Flarum Forum su Ubuntu 20.04

Flarum è un'applicazione per forum gratuita, open source e di nuova generazione che ti aiuta a creare il tuo forum di discussione online. È scritto in PHP, semplice, veloce e facile da implementare. Fornisce un'architettura flessibile, una potente estensione APT e tutte le funzionalità necessarie per gestire una community di successo. Flarum sembra e si sente benissimo fuori dagli schemi. L'interfaccia utente è ottimizzata in modo da poter dedicare meno tempo a fare clic e più tempo a parlare.

In questo tutorial spiegheremo come installare il forum Flarum con Apache e Let's Encrypt SSL su server Ubuntu 20.04.

Prerequisiti

  • Un server che esegue Ubuntu 20.04.
  • Un nome di dominio valido puntato all'IP del tuo server.
  • Una password di root è configurata sul server.

Per iniziare

Innanzitutto, si consiglia sempre di aggiornare i pacchetti di sistema all'ultima versione. Puoi aggiornarli usando il seguente comando:

apt-get update -y

Una volta aggiornati tutti i pacchetti, puoi procedere al passaggio successivo.

Installa il server LAMP

Flarum è scritto in PHP, gira sul server web e usa MySQL/MariaDB come database backend. Quindi dovrai installare lo stack LAMP nel tuo sistema. Puoi installarlo con il seguente comando:

apt-get install apache2 mariadb-server php7.4 libapache2-mod-php7.4 php7.4-common php7.4-mbstring php7.4-xmlrpc php7.4-soap php7.4-mysql php7.4-gd php7.4-xml php7.4-curl php7.4-cli php7.4-zip php7.4-tokenizer wget unzip curl git -y

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

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

Modifica le seguenti righe:

file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_file_size = 150M
max_execution_time = 450
date.timezone = Asia/Kolkata

Salva e chiudi il file quando hai finito.

Crea un database Flarum

Successivamente, dovrai creare un database e un utente per Flarum. Innanzitutto, accedi alla shell MariaDB con il seguente comando:

mysql

Una volta effettuato l'accesso, crea un database e un utente con il seguente comando:

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

Quindi, concedi tutti i privilegi al database flarum con il seguente comando:

MariaDB [(none)]> GRANT ALL PRIVILEGES ON flarum.* TO 'flarum'@'localhost';

Quindi, svuota i privilegi ed esci da MariaDB con il seguente comando:

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

Una volta terminato, puoi procedere al passaggio successivo.

Installa Composer

Successivamente, dovrai installare Composer nel tuo sistema. Composer è un gestore delle dipendenze per PHP utilizzato per installare tutte le dipendenze richieste per il progetto PHP.

Puoi installare il Composer con il seguente comando:

curl -s https://getcomposer.org/installer | php

Dovresti ottenere il seguente output:

All settings correct for using Composer
Downloading...

Composer (version 1.10.10) successfully installed to: /root/composer.phar
Use it: php composer.phar

Quindi, sposta il binario Composer nella directory /usr/local/bin/ con il seguente comando:

mv composer.phar /usr/local/bin/composer

Successivamente, verifica la versione installata di Composer con il seguente comando:

composer -V

Dovresti vedere il seguente output:

Composer version 1.10.10 2020-08-03 11:35:19

Installa Flarum

Innanzitutto, crea una directory per Flarum all'interno della directory principale web di Apache con il seguente comando:

mkdir /var/www/html/flarum

Quindi, cambia la directory in flarum e scarica l'ultima versione di Flarum utilizzando il Composer come mostrato di seguito:

cd /var/www/html/flarum
composer create-project flarum/flarum . --stability=beta

Quindi, installa tutte le dipendenze PHP usando il seguente comando:

composer install

Una volta installate tutte le dipendenze, cambia la proprietà di Flarum in www-data e dai il permesso appropriato con il seguente comando:

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

Una volta terminato, puoi procedere al passaggio successivo.

Configura Apache per Flarum

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

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

Aggiungi le seguenti righe:

<VirtualHost *:80>
 ServerAdmin [email protected]
 DocumentRoot /var/www/html/flarum/public
 ServerName flarum.linuxbuz.com
 DirectoryIndex index.php
 <Directory /var/www/html/flarum/public/>
Options +FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
 </Directory>
 ErrorLog /var/log/apache2/flarum-error_log
 CustomLog /var/log/apache2/flarum-access_log common
</VirtualHost>

Salva e chiudi il file quando hai finito. Quindi, abilita l'host virtuale Flarum e il modulo di riscrittura di Apache con il seguente comando:

a2ensite flarum
a2enmod rewrite

Infine, riavvia il servizio Apache per applicare le modifiche:

systemctl restart apache2

Puoi anche verificare lo stato di Apache usando 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 2020-08-23 09:57:11 UTC; 2min 44s ago
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 27164 (apache2)
      Tasks: 6 (limit: 2353)
     Memory: 12.3M
     CGroup: /system.slice/apache2.service
             ??27164 /usr/sbin/apache2 -k start
             ??27165 /usr/sbin/apache2 -k start
             ??27166 /usr/sbin/apache2 -k start
             ??27167 /usr/sbin/apache2 -k start
             ??27168 /usr/sbin/apache2 -k start
             ??27169 /usr/sbin/apache2 -k start

Aug 23 09:57:11 ubuntu2004 systemd[1]: Starting The Apache HTTP Server...

Proteggi Flarum con Let's Encrypt SSL

Si consiglia sempre di proteggere il proprio sito Web con Let's Encrypt SSL gratuito. Innanzitutto, installa il client Certbot Let's Encrypt con il seguente comando:

apt-get install python3-certbot-apache -y

Una volta installato, esegui il seguente comando per installare Let's Encrypt SSL per il tuo sito Web Flarum:

certbot --apache -d flarum.linuxbuz.com

Ti verrà chiesto di fornire il tuo indirizzo email valido e di accettare i termini del servizio come mostrato di seguito:

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

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for flarum.linuxbuz.com
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/flarum-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/flarum-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/flarum-le-ssl.conf

Quindi, scegli 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 il certificato SSL per il tuo sito web. Una volta completata l'installazione, dovresti ottenere il seguente output:

Redirecting vhost in /etc/apache2/sites-enabled/flarum.conf to ssl vhost in /etc/apache2/sites-available/flarum-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://flarum.linuxbuz.com

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/flarum.linuxbuz.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/flarum.linuxbuz.com/privkey.pem
   Your cert will expire on 2020-11-21. 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"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - 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

 - We were unable to subscribe you the EFF mailing list because your
   e-mail address appears to be invalid. You can try again later by
   visiting https://act.eff.org.

Accedi al forum Flarum

A questo punto, Flarum è installato, configurato e protetto con Let's Encrypt SSL. Ora apri il tuo browser web e accedi a Flarum usando l'URL https://flarum.linuxbuz.com. Verrai reindirizzato alla seguente pagina:

Fornisci il nome del forum, il nome del database, il nome utente, la password, il nome utente dell'amministratore, la password, l'indirizzo e-mail e fai clic su Installa Flarum pulsante. Una volta completata l'installazione, verrai reindirizzato alla dashboard di Flarum come mostrato di seguito:

Conclusione

Congratulazioni! hai installato con successo il forum Flarum con Apache e Let's Encrypt SSL sul server Ubuntu 20.04. Ora puoi ospitare facilmente il tuo forum della community con Flarum. Sentiti libero di chiedermi se hai domande.


Ubuntu
  1. Come installare Logstash su Ubuntu 18.04

  2. Come installare XWiki su Ubuntu 20.04

  3. Come installare phpBB su Ubuntu 20.04

  4. Come installare MongoDB su Ubuntu 20.04

  5. Come installare R su Ubuntu 18.04

Come installare Ruby su Ubuntu 18.04

Come installare Kanboard su Ubuntu 20.04

Come installare OpenMAINT su Ubuntu 20.04

Come installare Socioboard su Ubuntu 20.04

Come installare PrestaShop su Ubuntu 20.04

Come installare MediaWiki su Ubuntu 20.04