Come installare Akaunting con Apache e crittografare SSL su Ubuntu 22.04
Questo tutorial esiste per queste versioni del sistema operativo
- Ubuntu 22.04 (Jammy Jellyfish)
- Ubuntu 18.04 (Bionic Beaver)
Su questa pagina
- Prerequisiti
- Installa Apache, MariaDB e PHP
- Configura database MariaDB
- Installa Akaunting
- Configura Apache per Akaunting
- Akaunting sicuro con Lets Encrypt SSL
- Accedi all'interfaccia web di Akaunting
- Conclusione
Akaunting è un'applicazione software di contabilità open source e self-hosted per piccole imprese e liberi professionisti. È costruito utilizzando Laravel, Bootstrap, jQuery e RESTful API. Viene utilizzato per creare e gestire fatture, preventivi e finanze tramite un browser web. Fornisce un fantastico App Store per utenti e sviluppatori per estendere le funzionalità di Akaunting.
In questo tutorial, ti mostrerò come installare il software di contabilità Akaunting con Apache e Lets Encrypt SSL su Ubuntu 22.04.
Prerequisiti
- Un server che esegue Ubuntu 22.04.
- Nome di dominio valido indicato con l'IP del tuo server.
- Sul server è configurata una password di root.
Installa Apache, MariaDB e PHP
Innanzitutto, dovrai installare Apache, MariaDB, PHP e altre estensioni PHP sul tuo server. Puoi installarli tutti eseguendo il seguente comando:
apt-get install apache2 mariadb-server php libapache2-mod-php php-common php-imap php-mbstring php-xmlrpc php-soap php-gd php-xml php-intl php-mysql php-cli php-bcmath php-ldap php-zip php-curl unzip curl -y
Dopo aver installato tutti i pacchetti, modifica il file di configurazione PHP e modifica le impostazioni predefinite:
nano /etc/php/8.1/apache2/php.ini
Change the following lines:
memory_limit = 256M upload_max_filesize = 16M post_max_size = 16M max_execution_time = 300 date.timezone = UTC
Salva e chiudi il file, quindi riavvia il servizio Apache per applicare le modifiche alla configurazione:
systemctl restart apache2
Configura database MariaDB
Akaunting utilizza MariaDB/MySQL come database back-end. Quindi dovrai creare un database e un utente per Akaunting.
Innanzitutto, accedi a MariaDB con il seguente comando:
mysql
Una volta effettuato l'accesso, crea un database e un utente per Akaunting con il seguente comando:
MariaDB [(none)]> CREATE DATABASE akaunting_db;
MariaDB [(none)]> CREATE USER 'akaunting_user'@'localhost' IDENTIFIED BY 'password';
Successivamente, concedi tutti i privilegi al database Akaunting con il seguente comando:
MariaDB [(none)]> GRANT ALL ON akaunting_db.* TO 'akaunting_user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
Successivamente, scarica i privilegi ed esci da MariaDB con il seguente comando:
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;
Installa Akaunting
Innanzitutto, vai alla pagina di download ufficiale di Akaunting e scarica l'ultima versione utilizzando il seguente comando:
wget -O Akaunting.zip https://akaunting.com/download.php?version=latest
Una volta completato il download, decomprimere il file scaricato nella directory root Web di Apache:
mkdir -p /var/www/html/akaunting
unzip Akaunting.zip -d /var/www/html/akaunting
Successivamente, modifica la proprietà e l'autorizzazione della directory Akaunting:
chown -R www-data:www-data /var/www/html/akaunting/
chmod -R 755 /var/www/html/akaunting/
Una volta terminato, puoi procedere al passaggio successivo.
Configura Apache per Akaunting
Successivamente, dovrai creare un file di configurazione dell'host virtuale Apache per Akaunting. Puoi crearlo con il seguente comando:
nano /etc/apache2/sites-available/akaunting.conf
Aggiungi le seguenti righe:
<VirtualHost *:80> ServerAdmin DocumentRoot /var/www/html/akaunting ServerName akaunting.example.com DirectoryIndex index.html index.php <Directory /var/www/html/akaunting/> Options +FollowSymlinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/akaunting_error.log CustomLog ${APACHE_LOG_DIR}/akaunting_access.log combined </VirtualHost>
Salva e chiudi il file, quindi attiva l'host virtuale Apache e il modulo di riscrittura con il seguente comando:
a2ensite akaunting
a2enmod rewrite
Successivamente, riavvia il servizio Apache per applicare le modifiche:
systemctl restart apache2
Ora puoi controllare lo stato di Apache con il seguente comando:
systemctl status apache2
Otterrai il seguente output:
? apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2022-11-12 13:45:47 UTC; 10s ago Docs: https://httpd.apache.org/docs/2.4/ Process: 16032 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Main PID: 16036 (apache2) Tasks: 6 (limit: 464122) Memory: 14.2M CGroup: /system.slice/apache2.service ??16036 /usr/sbin/apache2 -k start ??16037 /usr/sbin/apache2 -k start ??16038 /usr/sbin/apache2 -k start ??16039 /usr/sbin/apache2 -k start ??16040 /usr/sbin/apache2 -k start ??16041 /usr/sbin/apache2 -k start Nov 12 13:45:47 ubuntu22041 systemd[1]: Starting The Apache HTTP Server...
Akaunting sicuro con Lets Encrypt SSL
Successivamente, è una buona idea proteggere il tuo sito web con Lets Encrypt SSL. Innanzitutto, installa il client Certbot utilizzando il seguente comando:
apt-get install certbot python3-certbot-apache -y
Una volta installato, esegui il seguente comando per proteggere il tuo sito web con Lets Encrypt SSL:
certbot --apache -d akaunting.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 akaunting.example.com Enabled Apache rewrite module Waiting for verification... Cleaning up challenges Created an SSL vhost at /etc/apache2/sites-available/akaunting-le-ssl.conf Enabled Apache socache_shmcb module Enabled Apache ssl module Deploying Certificate to VirtualHost /etc/apache2/sites-available/akaunting-le-ssl.conf Enabling available site: /etc/apache2/sites-available/akaunting-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/akaunting.conf to ssl vhost in /etc/apache2/sites-available/akaunting-le-ssl.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://akaunting.example.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=akaunting.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/akaunting.example.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/akaunting.example.com/privkey.pem Your cert will expire on 2023-02-12. 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
Accedi all'interfaccia web di Akaunting
Ora apri il tuo browser web e accedi all'interfaccia web di Akaunting utilizzando l'URL http://akaunting.example.com. Otterrai la seguente schermata:
Seleziona la lingua e fai clic sul pulsante Avanti. Otterrai la schermata di configurazione del database:
Fornisci i dettagli del tuo database e fai clic sul pulsante Avanti. Otterrai la schermata di creazione dell'account utente Admin:
Fornisci il nome della tua azienda, e-mail, password e fai clic sul pulsante Avanti. Otterrai la schermata di accesso di Akaunting:
Fornisci il nome utente e la password dell'amministratore e fai clic sul pulsante Accedi. Otterrai la seguente schermata:
Fare clic sul pulsante Salta. Otterrai la schermata Valute:
Abilita le tue valute e fai clic sul pulsante Avanti. Verrà visualizzata la schermata del plug-in:
Installa i moduli richiesti e fai clic sul pulsante Avanti. Otterrai la seguente schermata:
Ora puoi creare la tua prima fattura dalla schermata sopra.
Conclusione
Congratulazioni! hai installato correttamente Akaunting con Apache e consente di crittografare SSL sul server Ubuntu 22.04. Ora puoi ospitare il software Akaunting nella tua organizzazione per gestire fatture, preventivi e finanze da qualsiasi luogo. Non esitate a chiedermi se avete domande.