Cómo instalar InvoicePlane con Apache y el certificado SSL Let’s Encrypt gratuito en Debian 11

Instalador de FacturaPlane

InvoicePlane es una aplicación gratuita, de código abierto y autohospedada para administrar sus cotizaciones, facturas, clientes y pagos. Lo utilizan muchas organizaciones y autónomos para gestionar sus pagos y facturas. Ofrece plantillas personalizadas, temas y otras herramientas que lo ayudan a aumentar la funcionalidad de InvoicePlane. También admite múltiples idiomas y múltiples proveedores de pago como Paypal, Stripe o incluso Bitcoin a través de Coinbase.

En este tutorial, le mostraremos cómo instalar InvoicePlane con Apache en Debian 11.

requisitos previos

  • Un servidor que ejecuta Debian 11.
  • Un nombre de dominio válido apuntado con la IP de su servidor.
  • Una contraseña de root está configurada en el servidor.

Instale Apache, PHP y MariaDB

Primero, deberá instalar el servidor web Apache, el servidor de la base de datos MariaDB, PHP y otras extensiones de PHP requeridas en su servidor. Puede instalarlos todos ejecutando el siguiente comando:

apt-get install apache2 mariadb-server php libapache2-mod-php php-common php-mbstring php-xmlrpc php-soap php-gd php-xml php-intl php-mysql wget unzip php-cli php-zip php-curl -y

Una vez que todos los paquetes estén instalados, edite el archivo de configuración de PHP y cambie la configuración predeterminada:

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

Cambia las siguientes líneas:

memory_limit = 256M
upload_max_filesize = 128M
max_execution_time = 360
date.timezone = UTC

Guarde y cierre el archivo, luego reinicie el servicio Apache para aplicar los cambios:

systemctl restart apache2

Crear una base de datos para InvoicePlane

A continuación, deberá asegurar la instalación de MariaDB y crear una base de datos y un usuario para InvoicePlane.

Primero, asegure la instalación de MariaDB usando el siguiente comando:

mysql_secure_installation

Responda todas las preguntas como se muestra a continuación:

Set root password? [Y/n] Y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

A continuación, conéctese al shell de MariaDB con el siguiente comando:

mysql -u root -p

Una vez que esté conectado, cree una base de datos y un usuario para InvoicePlane con el siguiente comando:

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

A continuación, otorgue todos los privilegios a InvoicePlane con el siguiente comando:

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

A continuación, ejecute el comando FLUSH PRIVILEGES para que MariaDB vuelva a cargar la tabla de privilegios:

MariaDB [(none)]> FLUSH PRIVILEGES;

Finalmente, salga del shell de MariaDB:

MariaDB [(none)]> EXIT

Instalar FacturaPlane

Primero, descargue la última versión de InvoicePlane con el siguiente comando:

wget -c -O v1.5.11.zip https://invoiceplane.com/download/v1.5.11

Una vez completada la descarga, cree un directorio para InvoicePlane y extraiga el archivo descargado dentro del directorio de InvoicePlane:

mkdir /var/www/html/invoiceplane
unzip v1.5.11.zip -d /var/www/html/invoiceplane

A continuación, navegue hasta el directorio InvoicePlane y cambie el nombre del archivo de configuración y el archivo .htaccess:

cd /var/www/html/invoiceplane
cp ipconfig.php.example ipconfig.php
cp htaccess .htaccess

A continuación, edite el archivo ipconfig.php con el siguiente comando:

nano ipconfig.php

Defina la URL de su sitio web y la configuración de la base de datos como se muestra a continuación:

IP_URL=http://invoice.example.com
DB_HOSTNAME=localhost
DB_USERNAME=invplane
DB_PASSWORD=password
DB_DATABASE=invplanedb
DB_PORT=3306

A continuación, establezca el permiso y la propiedad adecuados para el directorio InvoicePlane:

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

Configurar Apache para FacturaPlane

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

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

Agregue las siguientes líneas:

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/invoiceplane
     ServerName invoice.example.com


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

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

</VirtualHost>

Guarde y cierre el archivo, luego active el host virtual de Apache y el módulo de reescritura con el siguiente comando:

a2ensite invoiceplane.conf
a2enmod rewrite

A continuación, reinicie el servicio de Apache para aplicar los cambios de configuración:

systemctl restart apache2

Para verificar el estado de Apache, ejecute el siguiente comando:

systemctl status apache2

Obtendrá el siguiente resultado:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2022-01-21 08:42:34 UTC; 5s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 15965 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 15970 (apache2)
      Tasks: 6 (limit: 2341)
     Memory: 15.1M
        CPU: 82ms
     CGroup: /system.slice/apache2.service
             ??15970 /usr/sbin/apache2 -k start
             ??15971 /usr/sbin/apache2 -k start
             ??15972 /usr/sbin/apache2 -k start
             ??15973 /usr/sbin/apache2 -k start
             ??15974 /usr/sbin/apache2 -k start
             ??15975 /usr/sbin/apache2 -k start

Jan 21 08:42:34 debian11 systemd[1]: Starting The Apache HTTP Server...

Acceder a la interfaz de usuario web de InvoicePlane

Ahora, abra su navegador web y acceda a la interfaz web de InvoicePlane usando la URL http://factura.ejemplo.com. Deberías ver la siguiente página:

Instalador de FacturaPlane

Haga clic en el Configuración botón. Debería ver la página de selección de idioma:

Elige lengua

Seleccione su idioma y haga clic en el Continuar botón. Debería ver la página de requisitos previos:

Comprobación de requisitos previos

Haga clic en el Continuar botón. Deberías ver la siguiente página:

Detalles de la base de datos

Haga clic en el Continuar botón. Deberías ver la siguiente página:

Instalar tablas de base de datos

Haga clic en el Continuar botón. Deberías ver la siguiente página:

Crear una cuenta de usuario

Detalles de contacto

Proporcione la información de su cuenta de usuario administrador, la dirección y haga clic en el Continuar botón. Una vez que se haya instalado InvoicePlane, debería ver la siguiente página:

Instalación de FacturaPlane completa

Haga clic en el Acceso botón. Deberías ver la siguiente página:

Acceso

Proporcione su nombre de usuario de administrador, contraseña y luego haga clic en el Acceso botón. Debería ver el panel de InvoicePlane en la siguiente página:

Tablero de FacturaPlane

Proteja InvoicePlane 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. Puedes 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 2022-04-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

Conclusión

¡Felicidades! ha instalado exitosamente InvoicePlane con Apache y Let’s Encrypt SSL en Debian 11. Ahora puede implementar InvoicePlane en su empresa y comenzar a administrar sus pagos y facturas desde el navegador web.

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *