Roundcube is a free and open source webmail solution with a desktop-like user interface from a web browser, easy to install which runs on a standard web server. This tutorial will explain the different steps to install Roundcube on your Ubuntu 18.04 running a LAMP server. It provides the full functionality you expect from an email client, address book, searching message and contact, share folders and some others.
Before installing Roundcube you need to install a fully working web server such as LAMP (Linux Apache MySql PHP) server on your Ubuntu 18.04 To be able to send and receive mail through Roundcube, you also need to have postfix and dovecot installed on your Ubuntu.
1) Download Roudcube
While writing this tutorial, the actual latest stable version of Rouncube is 1.3.6. You can choose the most suitable version for you on the official download page. On your Ubuntu 18.04, download it through the terminal
# wget https://github.com/roundcube/roundcubemail/releases/download/1.3.6/roundcubemail-1.3.6-complete.tar.gz --2018-05-23 14:40:05-- https://github.com/roundcube/roundcubemail/releases/download/1.3.6/roundcubemail-1.3.6-complete.tar.gz Resolving github.com (github.com)... 192.30.255.112, 192.30.255.113 Connecting to github.com (github.com)|192.30.255.112|:443... connected. HTTP request sent, awaiting response... 302 Found .... ....
Now you see the package
# ls -l | grep roundcube -rw-r--r-- 1 root root 5529370 Apr 11 19:52 roundcubemail-1.3.6-complete.tar.gz
2) Install and configure Roundcube
You can now go through the installation process. First, you need to uncompress it
# tar xvf roundcubemail-1.3.6-complete.tar.gz roundcubemail-1.3.6/ .... ....
Then you have to move it in our web server tree and we will rename the folder during the operation.
# mv roundcubemail-1.3.6 /var/www/html/webmail
a) Create a database and user for Roundcube
You need to create the database in which Roundcube will store its information. First, log into mysql
# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g.
Now create the database
mysql> create database 'roundcubedb'; Query OK, 1 row affected (0.00 sec)
Create the user for the database and set the password
mysql> create user 'roundcube'@'localhost' IDENTIFIED BY 'your-password'; Query OK, 0 rows affected (0.00 sec)
Grant all the privileges on the roundcubedb
database and all of its tables to the roundcube user
mysql> GRANT ALL PRIVILEGES ON roundcubedb.* to 'roundcube'@'localhost'; Query OK, 0 rows affected (0.00 sec)
Now save the configuration then exit
mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) mysql> EXIT; Bye
Now you need to import initial tables to roundcubedb database because the database is blank. You need to initialize it through the mysql.initial.sql file contained in a sub-directory of the roundcube extracted folder that we move to web server tree. This will set up the structure of the database so Roundcube will know where to save its information.
# cd /var/www/html/webmail
Now check the presence of the SQL directory
# ls -l | grep SQL drwxr-xr-x 7 501 80 4096 Apr 11 11:13 SQL
Now you can initialize the data. You need to indicate the roundcube database and user. You will be prompted for the password
# mysql -u roundcube -p roundcubedb < SQL/mysql.initial.sql Enter password:
b) Configure apache for Roundcube
Now we need to configure the virtual host for Roundcube. It's more cleaner if we host multiple sites on our apache server. We will create a copy of the default apache configuration file
# cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/webmail.conf
Now edit the configuration file to have something as below
# vim /etc/apache2/sites-available/webmail.conf <VirtualHost *:80> ServerName webmail.mydomain.com or your-ip-address ServerAdmin alain@mydomain.com DocumentRoot /var/www/html/webmail ErrorLog ${APACHE_LOG_DIR}/webmailerror.log CustomLog ${APACHE_LOG_DIR}/webmailaccess.log combined <Directory /var/www/html/webmail> Options -Indexes AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost>
Normally when you install Apache, when entering the IP address or the domain name, the default home page is the apache's page. We will ask apache to stop hosting that default site and to host the roundcube virtual host as the default site. It means that when entering your IP address or the domain name, you will directly launch Roundcube.
# a2dissite 000-default Site 000-default disabled. To activate the new configuration, you need to run: systemctl reload apache2
While asking Apache to host Roundcube as default site, don't use the extension of the webmail configuration file but only the name of the file.
# a2ensite webmail Enabling site webmail. To activate the new configuration, you need to run: systemctl reload apache2
Now enable the mod_rewrite
Apache module for Roundcube
# a2enmod rewrite Enabling module rewrite. To activate the new configuration, you need to run: systemctl restart apache2
Then restart Apache to activate the new configuration
# systemctl restart apache2
You can check the status of apache
# systemctl status apache2
c) Configure and install Roundcube
Now we will configure Roundcube by firstly change the ownership and permission of our webmail folder so that Apache will be allowed to create and edit the configuration and logs files
# chown -R www-data:www-data /var/www/html/webmail/ # chmod 755 /var/www/html/webmail/temp/ /var/www/html/webmail/logs/
Now we can install Roundcube through the installer in its folder. Because we have configured webmail as the default site, to access Roundcube, we only need to indicate the domain name or the IP address followed by the name of the installer like that http://domain_name_or_IP/installer Normally, when we don't change the default site, we need to indicate the domain name or IP address, the webmail root folder and the name of the installer like that http://domain_name_or_IP/webmail/installer In our case, we will use the first address. Rouncube will check the environment of your server. Make sure to have all the php extensions required
Now go the next page. You will need to configure some setting to create the default configuration file for your webmail.
- General configuration: You can change the product name. It is the information that will appear at the bottom of the Roundcube login page
- Database setup: Here you will enter the database information of Rouncube that we have configured with Mysql
- IMAP setting: If you have a working mail server installed, you will need to enter its information for mail sending. If you don't, you can try with Gmail. We will configure Gmail with SSL so the port is 993. If you don't want to indicate the domain name every time (@gmail.com) then, fill the line username_domain with only the domain name and check the box auto_create_user to create a user in the database to prevent you from logging in
- SMTP setting: We will still use the Gmail smtp information and the port 465 for SSL. Make sure to check the box next to Use the current IMAP username and password for SMTP authentication so that you can leave the fields under smtp_user/smtp_pass blank
- Plugins: You can choose the suitable plugin to integrate into Roundcube. Read the description to choose the good one. You have some interesting plugins such as enigma for PGP encryption or emoticons, etc.
At the end of the page, choose CREATE CONFIG. This will save all the configuration in a file that will be saved in the webmail directory.
Now you can continue and test all the setting by filling in the good smtp and imap parameters for the tests.
You have a warning message from Roundcube asking to delete the installer file some security reasons.
# rm -rf /var/www/html/webmail/installer/
If the tests don't work, then make sure that you give the good information. If you still have the same issue, it means that you can need to allow less secure apps in Gmail if you don't want to face some restrictions from Google
Now you can go to the login page. Enter your credential information
Now you can see the home page of your Roundcube webmail. You can see that I have allowed less secure app
Now you can check and explore your Roundcube webmail client.
You can now access your mail server and log in with your credentials information through Roundcube. You can install new themes to enhance the look of your client and some plugins to add new functionality which can be suitable for your needs or for a better user experience.