GNU/Linux >> Linux Esercitazione >  >> Ubuntu

Come installare Invoice Ninja su Ubuntu 20.04

Invoice Ninja è un'app di fatturazione online gratuita e open source per liberi professionisti e aziende che ti aiuta ad accettare pagamenti, tenere traccia delle spese, creare proposte e impegni di tempo. È un'applicazione di fatturazione self-hosted molto simile alle applicazioni di fatturazione commerciale come Freshbooks. Ti consente di creare la tua fattura personalizzata e inviarla online in un secondo.

Invoice Ninja è molto utile per le piccole e medie imprese. Se stai cercando un software di fatturazione sicuro e facile da usare, Invoice Ninja è l'opzione migliore per te.

In questo tutorial, ti mostreremo come installare Invoice Ninja con Apache e Let's Encrypt SSL sul 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 di aggiornare i pacchetti di sistema all'ultima versione. Esegui il comando seguente per aggiornare tutti i pacchetti:

apt-get update -y

Una volta aggiornati tutti i pacchetti, installa le altre dipendenze richieste con il seguente comando:

apt-get install software-properties-common apt-transport-https ca-certificates gnupg2 -y

Una volta installate tutte le dipendenze, puoi procedere al passaggio successivo.

Installa il server LAMP

Successivamente, dovrai installare Apache, MariaDB e PHP sul tuo sistema. Innanzitutto, installa i pacchetti Apache e MariaDB con il seguente comando:

apt-get install apache2 mariadb-server -y

Dopo aver installato entrambi i pacchetti, dovrai installare PHP versione 7.2 e altre estensioni nel tuo sistema.

Per impostazione predefinita, Ubuntu 20.04 viene fornito con la versione PHP 7.4. Quindi dovrai aggiungere il repository Ondrej al tuo sistema.

Puoi aggiungere il repository PHP Ondrej con il seguente comando:

add-apt-repository ppa:ondrej/php

Una volta aggiunto il repository, installa PHP e altre estensioni con il seguente comando:

apt-get install php7.2 libapache2-mod-php7.2 php-imagick php7.2-fpm php7.2-mysql php7.2-common php7.2-gd php7.2-json php7.2-curl php7.2-zip php7.2-xml php7.2-mbstring php7.2-bz2 php7.2-intl php7.2-gmp unzip -y

Dopo aver installato tutti i pacchetti, verifica la versione installata di PHP con il seguente comando:

php -v

Dovresti vedere il seguente output:

PHP 7.2.34-8+ubuntu20.04.1+deb.sury.org+1 (cli) (built: Oct 31 2020 16:57:33) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.34-8+ubuntu20.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

Configura il database MariaDB

Successivamente, dovrai creare un database e un utente per Invoice Ninja. Innanzitutto, accedi alla console 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 invoicedb;
MariaDB [(none)]> create user [email protected] identified by 'password';

Quindi, concedi tutti i privilegi a fatturadb con il seguente comando:

MariaDB [(none)]> grant all privileges on invoicedb.* to [email protected];

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

MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;

Una volta terminato, puoi procedere al passaggio successivo.

Installa Invoice Ninja

Innanzitutto, scarica l'ultima versione di Invoice Ninja dal suo sito Web ufficiale:

wget -O invoice-ninja.zip https://download.invoiceninja.com/

Una volta completato il download, decomprimere il file scaricato nella directory principale di Apache utilizzando il seguente comando:

unzip invoice-ninja.zip -d /var/www/html/

Quindi, imposta le autorizzazioni e la proprietà appropriate con il seguente comando:

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

Una volta terminato, puoi procedere al passaggio successivo.

Configura Apache per Invoice Ninja

Successivamente, dovrai creare un file di configurazione dell'host virtuale apache per Invoice Ninja. Puoi crearlo con il seguente comando:

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

Aggiungi le seguenti righe:

<VirtualHost *:80>
    ServerName invoice.example.com
    DocumentRoot /var/www/html/ninja/public
    <Directory /var/www/html/ninja/public>
       DirectoryIndex index.php
       Options +FollowSymLinks
       AllowOverride All
       Require all granted
    </Directory>

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

    Include /etc/apache2/conf-available/php7.2-fpm.conf
</VirtualHost>

Salva e chiudi il file, quindi abilita il file host virtuale con il seguente comando:

a2ensite ninja.conf

Quindi, abilita i moduli Apache richiesti usando il seguente comando:

a2enmod mpm_event proxy_fcgi setenvif
a2enmod rewrite

Infine, riavvia il servizio Apache per applicare le modifiche:

systemctl restart apache2

Ora puoi verificare lo stato dell'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-12-27 07:15:15 UTC; 11s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 25097 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 25113 (apache2)
      Tasks: 55 (limit: 2353)
     Memory: 5.3M
     CGroup: /system.slice/apache2.service
             ??25113 /usr/sbin/apache2 -k start
             ??25114 /usr/sbin/apache2 -k start
             ??25115 /usr/sbin/apache2 -k start

Dec 27 07:15:15 ubuntu systemd[1]: Starting The Apache HTTP Server..

A questo punto, Apache è configurato per servire Invoice Ninja. Ora puoi procedere al passaggio successivo.

Accedi a Invoice Ninja

Ora apri il tuo browser web e accedi a Invoice Ninja utilizzando l'URL http://invoice.example.com . Verrai reindirizzato alla seguente pagina:

Fornisci l'URL del tuo sito web, i dettagli del database, il nome utente e la password dell'amministratore e fai clic su Invia pulsante. Verrai reindirizzato alla schermata di accesso di Invoice Ninja:

Fornisci il nome utente e la password dell'amministratore e fai clic su LOGIN pulsante. Dovresti vedere la dashboard di Invoice Ninja nella schermata seguente:

Secure Invoice Ninja con Let's Encrypt SSL

È sempre una buona idea proteggere il tuo sito Web con Let's Encrypt SSL. Sarà necessario 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 comando seguente per proteggere il tuo sito Web con Let's Encrypt SSL:

certbot --apache -d invoice.example.com

Ti verrà chiesto di fornire la tua email e di accettare i termini del 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): [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
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for invoice.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/invoice-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/invoice-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/invoice-le-ssl.conf

Quindi, 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 Let's Encrypt SSL per il tuo sito web:

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

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

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/invoice.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/invoice.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://invoice.example.com.

Conclusione

Congratulazioni! hai installato e configurato correttamente Invoice Ninja con Let's Encrypt SSL sul server Ubuntu 20.04. Ora puoi esplorare Invoice Ninja per ulteriori funzionalità e distribuirlo nell'ambiente di produzione. Sentiti libero di chiedermi se hai domande.


Ubuntu
  1. Come installare Logstash su Ubuntu 18.04

  2. Come installare Invoice Ninja su Ubuntu 18.04

  3. Come installare XWiki su Ubuntu 20.04

  4. Come installare phpBB su Ubuntu 20.04

  5. Come installare R su Ubuntu 18.04

Come installare Invoice Ninja su CentOS 7

Come installare Invoice Ninja su CentOS 8

Come installare Invoice Ninja su Ubuntu 18.04 LTS

Come installare Invoice Ninja su Ubuntu 20.04 LTS

Come installare Jenkins su Ubuntu 18.04

Come installare Ruby su Ubuntu 18.04