GNU/Linux >> Tutoriales Linux >  >> Ubuntu

Cómo instalar Factura Ninja en Ubuntu 20.04

Invoice Ninja es una aplicación de facturación en línea gratuita y de código abierto para autónomos y empresas que lo ayuda a aceptar pagos, realizar un seguimiento de los gastos, crear propuestas y tareas de tiempo. Es una aplicación de facturas autohospedada muy similar a las aplicaciones de facturas comerciales como Freshbooks. Le permite crear su propia factura personalizada y enviarla en línea en un segundo.

Invoice Ninja es muy útil para pequeñas o medianas empresas. Si está buscando un software de facturación seguro y fácil de usar, Invoice Ninja es la mejor opción para usted.

En este tutorial, le mostraremos cómo instalar Invoice Ninja con Apache y Let's Encrypt SSL en el servidor Ubuntu 20.04.

Requisitos

  • Un servidor con Ubuntu 20.04.
  • Un nombre de dominio válido apuntado con la IP de su servidor.
  • Se configura una contraseña de root en el servidor.

Cómo empezar

Primero, se recomienda actualizar los paquetes de su sistema a la última versión. Ejecute el siguiente comando para actualizar todos los paquetes:

apt-get update -y

Una vez que todos los paquetes estén actualizados, instale otras dependencias requeridas con el siguiente comando:

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

Una vez que todas las dependencias estén instaladas, puede continuar con el siguiente paso.

Instalar servidor LAMP

A continuación, deberá instalar Apache, MariaDB y PHP en su sistema. Primero, instale los paquetes de Apache y MariaDB con el siguiente comando:

apt-get install apache2 mariadb-server -y

Después de instalar ambos paquetes, deberá instalar PHP versión 7.2 y otras extensiones en su sistema.

De forma predeterminada, Ubuntu 20.04 se envía con la versión 7.4 de PHP. Por lo tanto, deberá agregar el repositorio de Ondrej a su sistema.

Puede agregar el repositorio de PHP Ondrej con el siguiente comando:

add-apt-repository ppa:ondrej/php

Una vez agregado el repositorio, instale PHP y otras extensiones con el siguiente 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

Después de instalar todos los paquetes, verifique la versión instalada de PHP con el siguiente comando:

php -v

Debería ver el siguiente resultado:

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

Configurar base de datos MariaDB

A continuación, deberá crear una base de datos y un usuario para Invoice Ninja. Primero, inicie sesión en la consola de MariaDB con el siguiente comando:

mysql

Una vez que inicie sesión, cree una base de datos y un usuario con el siguiente comando:

MariaDB [(none)]> create database invoicedb;
MariaDB [(none)]> create user [email protected] identified by 'password';

A continuación, otorgue todos los privilegios a la base de facturas con el siguiente comando:

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

A continuación, elimine los privilegios y salga de la consola de MariaDB con el siguiente comando:

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

Una vez que haya terminado, puede continuar con el siguiente paso.

Instalar Factura Ninja

Primero, descargue la última versión de Invoice Ninja desde su sitio web oficial:

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

Una vez que se complete la descarga, descomprima el archivo descargado en el directorio raíz de Apache usando el siguiente comando:

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

A continuación, establezca los permisos y la propiedad adecuados con el siguiente comando:

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

Una vez que haya terminado, puede continuar con el siguiente paso.

Configurar Apache para Invoice Ninja

A continuación, deberá crear un archivo de configuración de host virtual apache para Invoice Ninja. Puedes crearlo con el siguiente comando:

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

Agregue las siguientes líneas:

<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>

Guarde y cierre el archivo, luego habilite el archivo de host virtual con el siguiente comando:

a2ensite ninja.conf

Luego, habilite los módulos de apache requeridos usando el siguiente comando:

a2enmod mpm_event proxy_fcgi setenvif
a2enmod rewrite

Finalmente, reinicie el servicio Apache para aplicar los cambios:

systemctl restart apache2

Ahora puede verificar el estado de Apache usando el siguiente comando:

systemctl status apache2

Deberías obtener el siguiente resultado:

? 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..

En este punto, Apache está configurado para servir a Invoice Ninja. Ahora puede continuar con el siguiente paso.

Acceder a Factura Ninja

Ahora, abra su navegador web y acceda a Invoice Ninja usando la URL http://invoice.example.com . Será redirigido a la siguiente página:

Proporcione la URL de su sitio web, los detalles de la base de datos, el nombre de usuario del administrador, la contraseña y haga clic en Enviar botón. Será redirigido a la pantalla de inicio de sesión de Invoice Ninja:

Proporcione su nombre de usuario y contraseña de administrador y haga clic en INICIAR SESIÓN botón. Debería ver el panel de Invoice Ninja en la siguiente pantalla:

Secure Invoice Ninja con Let's Encrypt SSL

Siempre es una buena idea proteger su sitio web con Let's Encrypt SSL. Deberá instalar el cliente Certbot para instalar y administrar SSL. Puede instalarlo con el siguiente comando:

apt-get install python3-certbot-apache -y

Una vez que Certbot esté instalado, ejecute el siguiente comando para proteger su sitio web con Let's Encrypt SSL:

certbot --apache -d invoice.example.com

Se le pedirá que proporcione su correo electrónico y acepte el término del servicio como se muestra a continuación:

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

A continuación, seleccione si desea redirigir o no el tráfico HTTP a HTTPS como se muestra a continuación:

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

Escriba 2 y presione Entrar para instalar Let's Encrypt SSL para su sitio 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

Ahora puede acceder a su sitio web de forma segura utilizando la URL https://invoice.example.com.

Conclusión

¡Felicidades! ha instalado y configurado correctamente Invoice Ninja con Let's Encrypt SSL en el servidor Ubuntu 20.04. Ahora puede explorar Invoice Ninja para obtener más funciones e implementarlo en el entorno de producción. Siéntase libre de preguntarme si tiene alguna pregunta.


Ubuntu
  1. Cómo instalar Logstash en Ubuntu 18.04

  2. Cómo instalar Factura Ninja en Ubuntu 18.04

  3. Cómo instalar XWiki en Ubuntu 20.04

  4. Cómo instalar phpBB en Ubuntu 20.04

  5. Cómo instalar MongoDB en Ubuntu 20.04

Cómo instalar Factura Ninja en CentOS 7

Cómo instalar Factura Ninja en CentOS 8

Cómo instalar Factura Ninja en Ubuntu 18.04 LTS

Cómo instalar Factura Ninja en Ubuntu 20.04 LTS

Cómo instalar Jenkins en Ubuntu 18.04

Cómo instalar Ruby en Ubuntu 18.04