Cómo instalar Joomla con Apache2 y Let’s Encrypt en Ubuntu 20.04

Joomla es un sistema de gestión de contenidos de código abierto utilizado para publicar aplicaciones y sitios web en línea. Está escrito en PHP y utiliza MySQL/MariaDB como base de datos. Es un sistema sencillo, fácil de usar y construido sobre un marco de aplicación web modelo-vista-controlador preparado para móviles. Joomla viene con un montón de características y diseños que lo convierten en una buena apuesta para construir sitios profesionales.

En este tutorial, te mostraremos cómo instalar el CMS Joomla con Apache y asegurarlo con Let’s Encrypt SSL en Ubuntu 20.04.

Requisitos previos

  • Un servidor con Ubuntu 20.04 con 2 GB de RAM.
  • Un nombre de dominio válido apuntado con tu servidor.
  • Una contraseña de root configurada en tu servidor.

Instalar el servidor LAMP

En primer lugar, necesitarás instalar el servidor web Apache, MariaDB, PHP y otras extensiones de PHP en tu sistema. Puedes instalarlos con el siguiente comando:

apt-get install apache2 mariadb-server php7.4 libapache2-mod-php7.4 php7.4-cli php7.4-mysql php7.4-json php7.4-opcache php7.4-mbstring php7.4-intl php7.4-xml php7.4-gd php7.4-zip php7.4-curl php7.4-xmlrpc unzip -y

Una vez instalados todos los paquetes, edita el archivo php.ini y modifica algunos ajustes.

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

Cambia los siguientes valores:

memory_limit = 512M
upload_max_filesize = 256M
post_max_size = 256M
output_buffering = Off
max_execution_time = 300
date.timezone = Asia/Kolkata

Guarda y cierra el archivo cuando hayas terminado.

Crear una base de datos

En primer lugar, asegura la instalación de MariaDB y establece la contraseña de root de MariaDB con el siguiente comando:

mysql_secure_installation

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

Enter current password for root (enter for none):
Set root password? [Y/n] Y
New password:
Re-enter new password:
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, entra en el shell de MariaDB con el siguiente comando:

mysql -u root -p

Proporciona tu contraseña de root de MariaDB cuando se te pida y luego crea una base de datos y un usuario para Joomla con el siguiente comando:

MariaDB [(none)]> CREATE DATABASE joomladb CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
MariaDB [(none)]> GRANT ALL ON joomladb.* TO 'joomla'@'localhost' IDENTIFIED BY 'password';

A continuación, vacía los privilegios y sal del intérprete de comandos de MariaDB con el siguiente comando:

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

Descargar e instalar Joomla

En primer lugar, descarga la última versión de Joomla desde su sitio web oficial con el siguiente comando:

wget https://downloads.joomla.org/cms/joomla3/3-9-18/Joomla_3-9-18-Stable-Full_Package.zip

Una vez completada la descarga, descomprime el archivo descargado en el directorio raíz de la web de Apache con el siguiente comando:

unzip Joomla_3-9-18-Stable-Full_Package.zip -d /var/www/html/joomla

A continuación, cambia la propiedad del directorio joomla a www-data con el siguiente comando:

chown -R www-data:www-data /var/www/html/joomla

Una vez que hayas terminado, puedes pasar al siguiente paso.

Configurar Apache para Joomla

A continuación, crea un nuevo archivo de configuración del host virtual de Apache para servir a Joomla.

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

Añade el siguiente contenido:

<VirtualHost *:80>
  ServerName joomla.linuxbuz.com
  DirectoryIndex index.html index.php
  DocumentRoot /var/www/html/joomla

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

  <Directory /var/www/html/joomla>
      Options FollowSymLinks
      AllowOverride All
      Require all granted
  </Directory>

</VirtualHost>

Guarda y cierra el archivo y luego habilita el host virtual de Apache y reinicia el servicio de Apache con el siguiente comando:

a2ensite joomla
systemctl restart apache2

Una vez que hayas terminado, puedes pasar al siguiente paso.

Asegurar Joomla con Let’s Encrypt SSL

En primer lugar, tendrás que instalar el cliente Certbot para instalar y gestionar el SSL de Let’s Encrypt. Puedes instalarlo con el siguiente comando:

apt-get install certbot python3-certbot-apache -y

Una vez instalado Certbot, ejecuta el siguiente comando para descargar e instalar Let’s Encrypt SSL para tu sitio web:

certbot --apache -d joomla.linuxbuz.com

Se te pedirá que proporciones tu dirección de correo electrónico y que aceptes las condiciones del servicio, como se muestra a continuación:

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 joomla.linuxbuz.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/joomla-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/joomla-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/joomla-le-ssl.conf

A continuación, selecciona si quieres redirigir 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

Escribe 2 y pulsa Enter para finalizar la instalación como se muestra a continuación.

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

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

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/joomla.linuxbuz.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/joomla.linuxbuz.com/privkey.pem
   Your cert will expire on 2020-08-19. 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.

En este punto, tu sitio web de Joomla está protegido con Let’s Encrypt SSL. Ahora puedes pasar al siguiente paso.

Acceder al CMS de Joomla

Ahora, abre tu navegador web y escribe la URL https://joomla.linuxbuz.com. Serás redirigido al asistente de instalación de Joomla basado en la web:

Proporciona el nombre de tu sitio, el correo electrónico del administrador, la contraseña y haz clic en el botón Siguiente. Deberías ver el asistente de configuración de la base de datos:

Proporciona el nombre de tu base de datos de Joomla, el nombre de usuario de la base de datos, la contraseña y haz clic en el botón Siguiente. Deberías ver la página de finalización de Joomla:

Selecciona la opción que desees y haz clic en el botón Instalar. Deberías ver la siguiente página:

Revisa todas las configuraciones y haz clic en el botón Instalar. Una vez instalado Joomla, deberías ver la siguiente pantalla:

Ahora, elimina el directorio de instalación y haz clic en el botón Administrador. Deberías ver la página de inicio de sesión de Joomla:

Proporciona tu nombre de usuario de Joomla, tu contraseña y haz clic en el botón Iniciar sesión. Deberías ver el panel de control de Joomla en la siguiente página:

También puedes acceder a tu sitio web de Joomla visitando la URL https://joomla.linuxbuz.com. Deberías ver tu sitio web Joomla en la siguiente página:

Conclusión

Enhorabuena! has instalado y asegurado con éxito Joomla con Let’s Encrypt en Ubuntu 20.04. Ahora puedes construir fácilmente tu tienda de comercio electrónico, tu sitio web personal, tu sitio social o tu blog. No dudes en preguntarme si tienes alguna duda.

También te podría gustar...