Cómo instalar la última versión de RoundCube Webmail en Ubuntu 18.04 LTS

Roundcube es una solución de correo electrónico basada en la web, gratuita y de código abierto, escrita en PHP. Es un cliente IMAP basado en la web, por lo que también puedes acceder a tu servidor de correo electrónico desde tu navegador web. No es necesario que leas y envíes correos desde un cliente de correo de escritorio. Este tutorial muestra cómo instalar RoundCube con un servidor web Apache y asegurado por un certificado SSL Let’s encrypt en Ubuntu 18.04 LTS (Bionic Beaver).

Características de RoundCube

  • Soporte MIME, búsqueda de mensajes y corrección ortográfica.
  • Integración con el directorio LDAP para las libretas de direcciones.
  • Soporte de múltiples idiomas.
  • Soporte para carpetas compartidas/globales y ACLs IMAP.
  • Almacenamiento en caché incorporado para un acceso rápido al buzón.
  • Soporte para servidor SMTP externo e IDNA.

Requisitos

  • Un servidor con Ubuntu 18.04 LTS.
  • Un usuario no root con privilegios sudo.

Instalar el servidor LAMP

Antes de empezar, debes actualizar la lista de paquetes e instalar las actualizaciones pendientes:

sudo apt-get update
sudo apt-get upgrade

A continuación, instala Apache y MariaDB con el siguiente comando:

sudo apt-get install apache2 mariadb-server php7.2 php7.2-gd php-mysql php7.2-curl php7.2-zip php7.2-ldap php7.2-mbstring php-imagick php7.2-intl php7.2-xml unzip wget curl -y

Una vez instalados todos los paquetes, deberás cambiar la configuración de la zona horaria en el archivo php.ini. Puedes hacerlo con el siguiente comando:

sudo nano /etc/php/7.2/apache2/php.ini

Realiza los siguientes cambios:

date.timezone = Europe/Berlin

Guarda y cierra el archivo, luego inicia el servicio de Apache y MariaDB y habilítalos para que se inicien al arrancar con el siguiente comando:

sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl start mariadb
sudo systemctl enable mariadb

Descargar Roundcube

En primer lugar, tendrás que descargar la última versión de Roundcube en tu sistema. Puedes descargarla con el siguiente comando:

cd /tmp
wget https://github.com/roundcube/roundcubemail/releases/download/1.3.8/roundcubemail-1.3.8-complete.tar.gz

Una vez completada la descarga, extrae el archivo descargado con el siguiente comando:

tar -xvzf roundcubemail-1.3.8-complete.tar.gz

A continuación, mueve el directorio extraído al directorio raíz de la web de Apache:

mv roundcubemail-1.3.8 /var/www/html/roundcube

A continuación, da los permisos adecuados al directorio roundcube:

sudo chown -R www-data:www-data /var/www/html/roundcube
sudo chmod -R 775 /var/www/html/roundcube

Configurar la base de datos

Por defecto, la instalación de MariaDB no está asegurada. Así que primero tendrás que asegurarla. Puedes asegurarla ejecutando el siguiente script:

mysql_secure_installation

Responde a todas las preguntas que se muestran a continuación:

Change the password for root ? N
Remove anonymous users? Y
Disallow root login remotely? Y
Remove test database and access to it? Y
Reload privilege tables now? Y

Una vez asegurada la MariaDB, entra en el shell de MariaDB con el siguiente comando:

mysql -u root -p

Introduce tu contraseña de root, y luego crea una base de datos y un usuario para Roundcube:

MariaDB [(none)]> CREATE DATABASE roundcubedb;
MariaDB [(none)]> CREATE USER 'roundcube'@'localhost' IDENTIFIED BY 'password';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON roundcubedb.* to 'roundcube'@'localhost';

Sustituye la palabra ‘password’ por una contraseña segura de tu elección y recuerda esta contraseña, la necesitamos para la instalación de Roundcube más adelante. 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;

A continuación, tienes que importar las tablas iniciales a la base de datos roundcubedb. Puedes hacerlo con el siguiente comando:

cd /var/www/html/roundcube
mysql -u roundcube -p roundcubedb < SQL/mysql.initial.sql

Introduce la contraseña del usuario de la base de datos roundcube cuando se te solicite.

Configurar Apache para Roundcube

A continuación, tendrás que crear un archivo de host virtual de Apache para Roundcube. Puedes hacerlo con el siguiente comando:

sudo nano /etc/apache2/sites-available/roundcube.conf

Añade las siguientes líneas:

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

        ErrorLog ${APACHE_LOG_DIR}/roundcube_error.log
        CustomLog ${APACHE_LOG_DIR}/roundcube_access.log combined

        <Directory /var/www/html/roundcube>
                Options -Indexes
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

sustituye ejemplo.com por tu nombre de dominio. Guarda y cierra el archivo, y luego habilita el archivo de host virtual con el siguiente comando:

sudo a2ensite roundcube

A continuación, habilita el módulo de reescritura de Apache y reinicia el servidor Apache con el siguiente comando:

sudo a2enmod rewrite
sudo systemctl restart apache2

Habilitar SSL con Let’s encrypt para RoundCube

En este paso, habilitaremos el SSL para RoundCube utilizando un certificado SSL gratuito de Let’s encrypt. El primer paso es instalar el cliente Let’s encrypt de certbot que utilizaremos para obtener el certificado SSL.

sudo apt-get install certbot python-certbot-apache

Solicita el certificado SSL con este comando:

sudo certbot --apache

IMPORTANTE: El nombre de dominio o subdominio que utilices para el sitio web de RoundCube debe ser accesible desde Internet para obtener un certificado SSL. Certbot te hará ahora algunas preguntas. Consulta las respuestas en rojo.

root@server: certbot --apache
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-v01.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 EFF and
our work to encrypt the web, protect its users and defend digital rights.
-------------------------------------------------------------------------------
(Y)es/(N)o: n
Which names would you like to activate HTTPS for?
-------------------------------------------------------------------------------
1: roundcube.example.com
-------------------------------------------------------------------------------
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for roundcube.example.com
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/roundcube-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/roundcube-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/roundcube-le-ssl.conf
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
Redirecting vhost in /etc/apache2/sites-enabled/roundcube.conf to ssl vhost in /etc/apache2/sites-available/roundcube-le-ssl.conf
-------------------------------------------------------------------------------
Congratulations! You have successfully enabled https://roundcube.example.com
You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=roundcube.example.com
-------------------------------------------------------------------------------
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/roundcube.example.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/roundcube.example.com/privkey.pem
Your cert will expire on 2019-06-25. 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

El vhost de RoundCube es accesible por https ahora.

Accede al Webmail

Ahora, abre tu navegador web y escribe la URL https://example.com/installer (¡sustituye ejemplo.com por tu nombre de dominio en la URL!). Serás redirigido a la siguiente página:

Instalador web de RoundCube

Instalador web - parte 2

Una vez completados todos los requisitos, haz clic en el botón Siguiente. Deberías ver la siguiente página:

Configuración General:

Configuración general

Configuración del registro y de la base de datos:

Configuración de la base de datos

Rellena aquí los detalles de la base de datos de roundcubedb que creaste en el paso de configuración de la base de datos.

Configuración de SMTP e IMAP:

Configuración de SMTP

Configuración de IMAP

Plugins:

Plugins

Aquí, proporciona todos los detalles según tu necesidad, y luego haz clic en el botón CREAR CONFIG. Deberías ver la siguiente página:

Crea la configuración

A continuación, haz clic en el botón Continuar. Deberías ver la siguiente página:

Configuración creada

Ahora, haz clic en el botón Comprobar inicio de sesión. Tras completar la instalación, elimina el directorio /var/www/html/roundcube/installer:

sudo rm -rf /var/www/html/roundcube/installer

Ahora, accede a tu webmail utilizando la URL http://your-ip-address o http://your-domain.com e inicia sesión con tu correo electrónico.

Inicio de sesión en Roundcube

RoundCube ha sido instalado con éxito en Ubuntu 18.04 LTS.

También te podría gustar...