Install Roundcube on Ubuntu 16.04
Traducciones al EspañolEstamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Roundcube is a web-based IMAP email client that offers a user interface similar to Google’s Gmail. It is a server-side application written in PHP designed to access an email server or service. Email users interact with Roundcube using a web browser.
Familiarize yourself with our Getting Started guide and complete the steps for setting your Linode’s hostname and timezone.
Complete the sections of our Setting Up and Securing a Compute Instance to create a standard user account, harden SSH access and remove unnecessary network services.
This guide is designed to work with our Installing Postfix, Dovecot, and MySQL tutorial, but you can use a different mail server.
Configure an A HOST or CNAME DNS record (a subdomain) to point at your Linode. For this guide, the subdomain
webmailwill be used. Refer to our Introduction to DNS Records guide if you need help creating this record.
Update your server’s software packages:
sudo apt-get update && sudo apt-get upgrade
sudo. If you’re not familiar with the
sudocommand, you can check our Users and Groups guide.
This section will cover installing Apache, MySQL, PHP and SSL on your Linode from scratch. If you already have a functioning LAMP stack, skip ahead to the section for Creating an Apache Virtual Host with SSL.
lamp-server^metapackage, which installs Apache, MySQL, and PHP as dependencies:
sudo apt-get install lamp-server^
During the installation process, you will be asked to choose a password for the root MySQL user.
Secure your new MySQL installation:
Specify your Linode’s time zone in the
/etc/php/7.0/apache2/php.iniPHP configuration file. If your server is not using UTC, replace it with your local timezone listed on PHP.net:
sudo sed -i -e "s/^;date\.timezone =.*$/date\.timezone = 'UTC'/" /etc/php/7.0/apache2/php.ini
We will create a new virtual host for Roundcube in this section. This makes a new webroot for Roundcube, separating it from any other webroots on your Linode.
Position your Linode’s shell prompt within the
Download a copy of our
apache2-roundcube.sample.confvirtual host configuration file. Replace instances of
webmail.example.comwith the desired domain or subdomain of your installation.
sudo wget https://www.linode.com/docs/assets/roundcube/apache2-roundcube.sample.conf
Transfer the file’s ownership to root:
sudo chown root:root apache2-roundcube.sample.conf
Next, change the file’s access permissions:
sudo chmod 644 apache2-roundcube.sample.conf
Determine what type of Secure Socket Layer (SSL) encryption certificate is best for your Roundcube deployment. A self-signed SSL certificate is easy and free, but triggers an error in most modern browsers reporting that the connection is not private. Let’s Encrypt offers browser trusted, free SSL certificates, but does not support Extended Validation (EV) or multi-domain (wildcard) certificates. To gain those features, a commercial SSL certificate must be used.
Once you have your SSL certificate, edit the following options in
apache2-roundcube.sample.confto match your desired configuration:
Make sure the custom directory and desired
- ServerAdmin: administrative email address for your Linode (e.g.
- ServerName: full domain name of the virtual host (e.g.
- ErrorLog (optional): path to the custom error log file (e.g.
/var/log/apache2/webmail.example.com/error.log; uncomment by removing
- CustomLog (optional): path to the custom access log file (e.g.
/var/log/apache2/webmail.example.com/access.log; again, uncomment by removing
- SSLCertificateFile: path to the SSL certificate information (
- SSLCertificateKeyFile: path to the SSL certificate private key (
.logfiles exist before specifying them in your virtual host configuration. Failure to do so will prevent Apache from starting. The files should be owned by the
- ServerAdmin: administrative email address for your Linode (e.g.
Rename your configuration file to match its full domain name:
sudo mv apache2-roundcube.sample.conf webmail.example.com.conf
Lastly, disable the default Apache virtual host unless you plan to use it.
sudo a2dissite 000-default.conf default-ssl.conf
Log into the MySQL command prompt as the root user:
mysql -u root -p
Once logged in and the
mysql>prompt is shown, create a new MySQL database called
CREATE DATABASE roundcubemail;
Create a new MySQL user called
roundcubeand assign it a strong password:
CREATE USER 'roundcube'@'localhost' IDENTIFIED BY 'example_password';
Grant the new
roundcubeuser full access to Roundcube’s database
GRANT ALL PRIVILEGES ON roundcubemail.* TO 'roundcube'@'localhost';
Flush the MySQL privilege tables to reload them:
Log out of the MySQL command prompt and return to a regular Linux shell prompt:
Install and enable required PHP packages:
sudo apt-get install php-pear php7.0-intl php7.0-mcrypt php7.0-mbstring && sudo phpenmod intl mcrypt mbstring
Enable the Apache modules
sudo a2enmod deflate expires headers rewrite ssl
Additionally, install the PHP PEAR packages
sudo pear install Auth_SASL2 Net_SMTP Net_IDNA2-0.1.1 Mail_mime Mail_mimeDecodePEAR is an acronym for “PHP Extension and Application Repository”. Common PHP code libraries, written officially or by third parties, can be easily installed and referenced using the
PEAR will print an install ok confirmation message for each package that it successfully installs. In this case, a complete installation will look similar to this:
install ok: channel://pear.php.net/Auth_SASL-1.1.0 install ok: channel://pear.php.net/Net_IDNA2-0.1.1 install ok: channel://pear.php.net/Mail_Mime-1.10.2 install ok: channel://pear.php.net/Net_Socket-1.2.2 install ok: channel://pear.php.net/Net_SMTP-1.8.0 install ok: channel://pear.php.net/Mail_mimeDecode-1.5.6
Make sure your Linode’s shell prompt is operating inside your user’s home directory. The
~/Downloadsfolder is preferable, but
~/is also acceptable.
Download Roundcube. At the time of this writing, the current stable version is 1.3.3, so it will be used for the rest of this guide.
Decompress and copy Roundcube to the
/var/wwwdirectory. Again, replace any occurrences of
1.3.3in the filename with a newer version number if necessary:
sudo tar -zxvf roundcubemail-1.3.3-complete.tar.gz -C /var/www
Eliminate the version number from Roundcube’s directory name. This will make updating easier later:
sudo mv /var/www/roundcubemail-1.3.3 /var/www/roundcube
Transfer ownership of the
/var/www/roundcubedirectory to the
www-datauser. This will allow Roundcube to save its own configuration file, instead of you having to download it and then manually upload it to your Linode:
sudo chown -R www-data:www-data /var/www/roundcube
Lastly, you should enable Roundcube’s automatic cache-cleaning shell script:
echo '0 0 * * * root bash /var/www/roundcube/bin/cleandb.sh >> /dev/null' | sudo tee --append /etc/crontab
This utilizes a cron job to run the
cleandb.shshell script included with Roundcube once per day at midnight. Read our Scheduling Tasks with Cron guide to learn about Cron.
webmail.example.comvirtual host you just wrote in the Creating an Apache Virtual Host with SSL section:
sudo a2ensite webmail.example.com.conf
Restart Apache to apply all configuration changes and enable your new virtual host:
sudo service apache2 restart
The output should be
* Restarting web server apache2 ... [ OK ]. If an error is given, use the error messages to troubleshoot your configuration. Missing files, incorrect permissions and typos are common causes for Apache not properly restarting.
https://webmail.example.com/installerin a web browser. Again, make sure to replace
webmail.example.comwith your chosen domain name.
Begin configuring Roundcube. The first step of Roundcube’s graphical configuration is an environment check. Click on the NEXT button at the bottom of the page to continue.Since Roundcube supports six different SQL engines, five NOT AVAILABLE warnings will appear under the Checking available databases section. MySQL was installed earlier as part of the LAMP stack, so you can ignore these warnings.
Specify your Roundcube configuration options. The list of options below will get you a proper, working configuration, but you can adjust any unmentioned options as you see fit.
- General configuration > product_name: Name of your email service.
- General configuration > support_url: Where should your users go if they need help? A URL to a web-based contact form or an email address should be used. (e.g.
- General configuration > skin_logo: Replaces the default Roundcube logo with an image of your choice. The image must be located within the
/var/www/roundcubedirectory and be linked relatively (e.g.
skins/larry/logo.png). Recommended image resolution is
- Database setup > db_dsnw > Database password: Password for the roundcube MySQL user you created earlier.
- IMAP Settings > default_host: Hostname of your IMAP server. Set this to
ssl://plus the domain of your email server (e.g.
- IMAP Settings > username_domain: What domain name should Roundcube assume all users are part of? This allows users to only have to type in their email username (e.g. somebody) instead of their full email address (e.g.
- SMTP Settings > smtp_server: Hostname of your SMTP server. Set this to your email server domain, prefixed with
- SMTP Settings > smtp_user/smtp_pass: Click and check the Use the current IMAP username and password for SMTP authentication checkbox so that users can send mail without re-typing their user credentials.
- Display settings & user prefs > language: Allows you to select a default RFC1766-compliant locale for Roundcube. For a full listing of the supported language codes, run
cat /usr/share/i18n/SUPPORTEDon your Linode.
- Display settings & user prefs > draft_autosave: Most users will expect their drafts to be saved almost instantaneously while they type them. While Roundcube does not offer instantaneous draft saving as an option, it can save a user’s draft every minute. Select
1 minfrom the dropdown menu.
Click on the CREATE CONFIG button toward the bottom of the page to save your new configuration. You should see a confirmation message on the corresponding page saying: The config file was saved successfully into RCMAIL_CONFIG_DIR directory of your Roundcube installation.
Complete the configuration by clicking CONTINUE.
Lastly, import Roundcube’s MySQL database structure by clicking on the Initialize database button.
/var/www/roundcube/installerdirectory, which contains the web page files just used to configure Roundcube:
sudo rm -rf /var/www/roundcube/installer
While Roundcube automatically disabled the installer functionality within its configuration file, deleting the installer directory adds another layer of protection against intruders.
https://webmail.example.comand log in using your email account’s username and password. If your configuration is functional, Roundcube will allow you to receive, read and send emails from inside and outside of your domain name.
Compare the Stable > Complete package version listed on Roundcube’s download page to the version currently installed on your Linode.
If a newer version is available, replace any occurrences of
1.3.3with the newest version in the command below. This will download Roundcube to your
cd ~/Downloads && wget https://github.com/roundcube/roundcubemail/releases/download/1.3.3/roundcubemail-1.3.3-complete.tar.gz
Extract and unzip the tarball (.tar.gz file) to
tar -zxvf roundcubemail-1.3.3.tar.gz
Begin updating Roundcube by executing the
/var/www/roundcube/bin/installto.shPHP script. If you did not install Roundcube in the
/var/www/roundcubedirectory, replace the trailing directory with that of Roundcube’s on your server:
cd roundcubemail-1.3.3 sudo php bin/installto.sh /var/www/roundcube
Confirm the update by pressing Y and then ENTER. A successful upgrade will print something similar to this:
Upgrading from 1.3.3. Do you want to continue? (y/N) y Copying files to target location...sending incremental file list ... Running update script at target... Executing database schema update. This instance of Roundcube is up-to-date. Have fun! All done.
All done means the update was successful; if you see this message, proceed to step six.
Delete the Roundcube directory and gzipped tarball from
cd ~/Downloads && rm -rfd roundcubemail-1.3.3 roundcubemail-1.3.3.tar.gz
Now that you have installed Roundcube, you have a free, web-based email client similar to Google’s Gmail. Users can access their email by navigating to
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
This page was originally published on