Home » Tutorial » Install and Configure Roundcube Webmail on Ubuntu 16.04

Install and Configure Roundcube Webmail on Ubuntu 16.04

Update on:
Oct 4, 2021

These days, many individuals use browser-based electronic mail purchasers like Gmail to entry their electronic mail. Nonetheless, if you wish to cease seeing advertisements while you test your electronic mail, or should you’ve moved from a public electronic mail service to your personal area, you possibly can run your personal webmail consumer (also called a mail person agent or MUA).

Roundcube is a contemporary and customizable IMAP-based webmail consumer written in PHP. It has a big set of options for viewing, organizing, and composing emails, in addition to assist for contacts and calendar administration. With its plugin repository, you possibly can add performance corresponding to the preferred browser-based purchasers.

To know the place Roundcube matches in your electronic mail infrastructure, let’s stroll by the parts that comprise electronic mail behind the scenes:

  • mail person agent (MUA) is the interface a person interacts with to view and ship electronic mail.
  • mail switch agent (MTA) transfers electronic mail from the sender to the recipient.
  • Easy Mail Switch Protocol (SMTP) is the protocol MUAs use to ship mail to MTAs.
  • mail supply agent (MDA) receives emails from MTAs and shops them.
  • Web Message Entry Protocol (IMAP) is a protocol that MDAs use to ship mail to MUAs.

Whenever you ship an electronic mail, your MUA transfers it to your electronic mail server’s MTA utilizing SMTP. After a number of hops, your recipient’s MTA will obtain the e-mail and switch it to their MDA utilizing IMAP. Then your recipient can view the e-mail utilizing their MUA of selection.

Conditions

To comply with this tutorial, you’ll need:

  • One Ubuntu 16.04 server arrange, together with a sudo non-root person and a firewall.
  • The LAMP stack put in.
  • An IMAP-based electronic mail server. For simplicity, this text will use Gmail, however any IMAP-based electronic mail server will work. Be sure you know the IMAP and SMTP settings to your electronic mail server.

Step 1 — Putting in Dependencies

Step one in organising Roundcube is putting in its dependencies and configuring PHP. As soon as Roundcube is put in, we are able to use its useful dependency test web page to confirm that all the pieces is about up correctly.

These are the Roundcube dependencies that aren’t included out of the field:

  • A number of PHP libraries (that are the php-* packages beneath, together with assist for XML and multi-byte strings)
  • Help instruments (zip and unzip to deal with compressed information)
  • Git for model management
  • The PHP plugin administration system (composer)

Replace your package deal index and set up all of those dependencies without delay.

$ sudo apt-get replace
$ sudo apt-get set up php-xml php-mbstring php-intl php-zip php-pear zip unzip git composer

Subsequent, among the PHP libraries should be enabled within the server’s php.ini file, which is situated at /and many others/php/7.0/apache2/php.ini. Open this file with nano or your favourite textual content editor.

$ sudo nano /and many others/php/7.0/apache2/php.ini

Most of the adjustments obligatory are simply enabling choices which were commented out. In php.ini information, commented traces begin with a ; semicolon (as an alternative of the extra widespread # hash image). To uncomment a line, delete this main semicolon; to remark a line, add a number one semicolon.

Seek for the part that accommodates many commented traces starting with extension=. Uncomment the traces for the php_mbstring.dll and php_xmlrpc.dll extensions.

/and many others/php/7.0/apache2/php.ini
. . .
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
;extension=php_exif.dll      ; Have to be after mbstring because it will depend on it
;extension=php_mysqli.dll
. . .
;extension=php_sqlite3.dll
;extension=php_tidy.dll
extension=php_xmlrpc.dll
;extension=php_xsl.dll
  . . .

Then add extension=dom.so to the underside of the extension block.

/and many others/php/7.0/apache2/php.ini
. . .
extension=php_xmlrpc.dll
;extension=php_xsl.dll
extension=dom.so
. . .

There are a couple of different modifications we have to make on this file.

First, seek for the date.timezone setting. Uncomment the road and add your timezone in citation marks. To see the right way to format your timezone within the php.ini file, you possibly can reference PHP’s timezone page. For instance, should you stay in Jap Commonplace Time, your file may appear like this:

/and many others/php/7.0/apache2/php.ini
. . .
[Date]
; Defines the default timezone utilized by the date features
; http://php.web/date.timezone
date.timezone = "America/New_York"
. . .

Subsequent, seek for the upload_max_filesize setting. This setting primarily impacts importing attachments. By default, it’s set to 2MB. You’ll be able to set it to any quantity you need, however most electronic mail servers restrict the full attachment dimension to 10MB. We’ll set it to 12MB right here within the occasion that a number of customers are including attachments on the identical time.

/and many others/php/7.0/apache2/php.ini
. . .
; Most allowed dimension for uploaded information.
; http://php.web/upload-max-filesize
upload_max_filesize = 12M
. . .

Subsequent, seek for post_max_size. Whereas the upload_max_filesize setting utilized solely to attachments, this setting applies to the scale of the entire electronic mail (together with attachments). To stop deadlocks, we’ll set this one to a barely increased worth.

/and many others/php/7.0/apache2/php.ini
. . .
; Most dimension of POST information that PHP will settle for.
; Its worth could also be 0 to disable the restrict. It's ignored if POST information studying
; is disabled by enable_post_data_reading.
; http://php.web/post-max-size
post_max_size = 18M
. . .

Lastly, seek for mbstring.func_overload, uncomment it, and confirm its worth is about to 0. This permits assist for multi-byte string features.

/and many others/php/7.0/apache2/php.ini
. . .
mbstring.func_overload = 0
. . .

Save and shut the file.

Your server is now arrange with a LAMP stack, Roundcube’s dependencies, and the mandatory PHP configuration. The subsequent step is downloading the Roundcube software program, putting in it, and configuring it.

Step 2 — Downloading Roundcube

As with many tasks within the Linux world, there are two methods to put in Roundcube: from a package deal or from supply. There’s a PPA for Roundcube, however as a result of the venture is beneath lively improvement, the PPA is usually outdated. (At time of writing, the PPA is on model 1.2.3 however the venture itself is at 1.3). To verify we’re getting the newest model, we’ll set up from supply.

Navigate to the Roundcube download page. Look beneath the Secure model part and find the Full package deal. Proper click on the Obtain button and choose Copy Hyperlink Handle.

Use this handle with wget to obtain the Roundcube tarball on the server.

$ wget https://github.com/roundcube/roundcubemail/releases/obtain/1.3.0/roundcubemail-1.3.0-complete.tar.gz

Decompress the Roundcube archive.

$ tar -xvzf roundcubemail-1.3.0-complete.tar.gz

Arguments for tar could be a bit intimidating, so right here’s what every flag does:

  • The x flag stands for extract.
  • The v flag stands for verbose, which tells tar to print the trail and identify of each file extracted.
  • The z flag tells tar to not solely take away the tar wrapper however to decompress the archive utilizing gzip. We all know the file is compressed with gzip as a result of the file extension has .gz on the tip.
  • The f flag stands for file. This should be the final flag as a result of tar makes use of no matter instantly follows it because the file to be extracted.

Subsequent, transfer the decompressed listing to /var/www and rename it to roundcube. Be certain to omit the trailing / within the listing names as a result of we need to transfer and rename the entire listing, not the contents within the listing.

$ sudo mv roundcubemail-1.3.0 /var/www/roundcube

Lastly, change the permissions to permit Apache to create and edit the information (like configuration information and logs). Particularly, change the proprietor and group to www-data, and alter the permissions to learn and write for the proprietor and group, however learn just for everybody else.

$ sudo chown -R www-data:www-data /var/www/roundcube/
$ sudo chmod 775 /var/www/roundcube/temp/ /var/www/roundcube/logs/

We’ve downloaded Roundcube’s code and up to date its location and permissions, nevertheless it’s solely partially put in at this level. To complete the set up, we have to join Roundcube to our database by way of Roundcube’s GUI. Earlier than we are able to try this, we have to inform Apache the place Roundcube is so it could possibly load the web site.

Step 3 — Configuring Apache

The file we have to edit to configure Apache is a virtual host file. Digital hosts are a function that permit Apache to host a number of websites on the identical server. Even when that is the one website Apache is internet hosting, it’s easier and cleaner to make use of a digital host configuration file than edit the primary Apache configuration.

Every .conf file situated beneath /and many others/apache2/sites-available/ signify a unique website. We’ll create a digital host file right here for Roundcube, then inform Apache about it so it could possibly make it obtainable by way of a browser.

First, copy the default configuration file to make use of as a place to begin for the brand new file

$ sudo cp /and many others/apache2/sites-available/000-default.conf /and many others/apache2/sites-available/roundcube.conf

Open the file together with your textual content editor.

$ sudo nano /and many others/apache2/sites-available/roundcube.conf

We’ll must make a variety of adjustments to this file. We’ll stroll by every of them first, then present the entire file to repeat and paste.

Within the current VirtualHost block, you’ll modify the next directives:

  • The ServerName tells Apache which area to take heed to. This ought to be your server IP handle or area identify, should you’re utilizing one.
  • DocumentRoot specifies the place to ship visitors when it is available in. In our case, we must always ship it to Roundcube at /var/www/roundcube.
  • ServerAdmin permits you to specify an contact electronic mail handle for any points with Apache. We aren’t configuring Apache to do this on this tutorial, nevertheless it’s finest follow to incorporate it anyway.
  • The 2 logging traces, ErrorLog and CustomLog, outline the place to save lots of profitable connection logs and error logs for this website. We have to give the error logs particular names so if there is a matter the logs particular to this website are simply discovered.

Then, you’ll add a brand new Listing block which tells Apache what to do with the Roundcube listing. The primary phrase in every line of a Listing block is the configuration identify adopted by the precise configuration choices.

  • Choices -Indexes tells Apache to show a warning if it could possibly’t discover an index.html or index.php file. By default, it would record the contents of the listing as an alternative.
  • AllowOverride All tells Apache that if a neighborhood .htaccess file is discovered, any choices in that file override the worldwide settings on this file.
  • Order permit,deny tells Apache first to permit matching purchasers entry to the positioning, after which to disclaim any that don’t match.
  • permit from all is a followup to the Order line. It defines what kind of consumer is allowed, which is any in our case.

Right here’s what the file will appear like when you’ve made these adjustments. For brevity, the feedback have been eliminated.

/and many others/apache2/sites-available/roundcube.conf
<VirtualHost *:80>
  ServerName your_server_ip_or_domain
  DocumentRoot /var/www/roundcube
  ServerAdmin sammy@instance.com
  ErrorLog ${APACHE_LOG_DIR}/roundcube-error.log
  CustomLog ${APACHE_LOG_DIR}/roundcube-access.log mixed
  <Listing /var/www/roundcube>
      Choices -Indexes
      AllowOverride All
      Order permit,deny
      permit from all
  </Listing>
</VirtualHost>

Save and shut the file.

Subsequent, inform Apache to cease internet hosting the default website.

$ sudo a2dissite 000-default

Then inform Apache to start out internet hosting the Roundcube website as an alternative. Be certain to not embrace the .conf when enabling the positioning; a2ensite desires the file identify of the configuration with out the extension.

$ sudo a2ensite roundcube

Allow the mod_rewrite Apache module, which Roundcube requires.

$ sudo a2enmod rewrite

Lastly, restart Apache, which is able to make the Roundcube set up accessible.

$ sudo apache2ctl restart

The webmail consumer is nearly prepared to make use of. The final step of the set up course of is to configure the database so Roundcube can retailer its app-specific information.

Step 4 — Configuring MySQL

At this level, should you open an internet browser and check out accessing your server (by IP handle or area identify, should you’re utilizing one), you’ll see a configuration error web page. It’s because Roundcube is checking for a file generated throughout configuration setup, however we haven’t gone by the configuration setup but. Earlier than we are able to undergo that setup, we have to put together the database.

Connect with the MySQL interactive shell. This command tells MySQL to authenticate because the person (-uroot and that we’ll specify a password (-p).

$ mysql -u root -p

After coming into the command you’ll be prompted for the basis password you created while you put in MySQL.

Now that we’re within the MySQL shell, we’ll create a database and a database person, after which give that person permissions to execute instructions on that new database.

Create the database first. This command creates a database referred to as roundcubemail after which offers database choices, just like the character set to make use of (utf8).

mysql> CREATE DATABASE roundcubemail /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;

In contrast to many different authentication programs, MySQL defines a person by a reputation and the place they’ll join from. This command creates a person referred to as roundcube and defines that person to attach from localhost. For functions accessing a database, defining the place the person will make the request from helps tighten safety.

Create this person, ensuring to alter the password to one thing safe.

mysql> CREATE USER 'roundcube'@'localhost' IDENTIFIED BY 'password';

Give the roundcube person all permissions on the roundcubemail database and all of its tables.

mysql> GRANT ALL PRIVILEGES ON roundcubemail.* to 'roundcube'@'localhost';

Then save your adjustments and stop the MySQL interactive shell.

mysql> FLUSH PRIVILEGES;
mysql> EXIT;

Now we have created a clean database, roundcubemail, and a person, roundcube@localhost, after which gave that person full permissions to the database. Now we have to arrange the construction of the database so Roundcube is aware of the place to save lots of its info. The Roundcube set up offers a file that’ll configure the database for us, so we don’t should do it by hand.

The next command tells MySQL to make use of our newly created person to learn in a file /var/www/roundcube/SQL/mysql.preliminary.sql and apply the configuration to the database roundcubemail.

$ mysql -u roundcube -p roundcubemail < /var/www/roundcube/SQL/mysql.preliminary.sql

You’ll be prompted to enter the roundcube person’s password.

Establishing the database on this means prepares it for Roundcube’s use and likewise permits us to confirm that now we have the proper permissions. If all was profitable, you’ll obtain no suggestions and be again on the command immediate. Then we’re prepared to inform Roundcube our electronic mail settings and finalize the set up.

Step 5 — Configuring Roundcube

As talked about earlier than, should you attempt to entry your Roundcube set up now, you’ll get an error web page. To complete the set up, we have to go to http://your_server_ip_or_domain/installer as an alternative.

If all the pieces’s arrange correctly, there might be a inexperienced OK to the proper of each line merchandise, apart from a couple of: the non-obligatory LDAP setting and each database line besides MySQL. If there’s a NOT AVAILABLE subsequent to some other line than these simply talked about, you’ll want to put in these dependencies. Roundcube helpfully offers a hyperlink for any lacking dependency so you possibly can determine what to put in.

As soon as all the pieces is about up appropriately, scroll all the way down to the underside of the web page and click on the NEXT button.

The shape on the following web page, which is damaged into seven sections, walks by producing the Roundcube configuration file. Beneath are the parts of the shape we have to fill out, divided by part. If a line from the shape is excluded within the sections beneath, you possibly can skip that line and go away it with the default settings.

Basic configuration

The Basic configuration part offers a couple of beauty choices for personalization and a few common settings. There’s just one choice you must change right here:

  • Be certain ip_check is ticked for better safety. It checks the consumer’s IP in session authorization.

There are a couple of extra non-obligatory adjustments you may make, too:

  • You’ll be able to change the product_name. This may be something you would like and all references to “Roundcube” in textual content might be changed with this identify as an alternative.
  • The support_url is a URL the place customers can get assist for his or her Roundcube set up. It isn’t strictly wanted, however it may be good if Roundcube is being offered for a gaggle of people that might have help. Should you don’t have a devoted assist desk website, you need to use an electronic mail handle, like mailto:sammy@instance.com.
  • You’ll be able to substitute the Roundcube brand with skin_logo, which takes a URL to a PNG file (178px by 47px). If you will allow HTTPS (extremely beneficial, and coated later on this tutorial), then be certain the picture URL is an HTTPS URL.

All different choices may be left at their default values.

Logging & Debugging

Go away all the pieces on this part at its default settings.

Database setup

Roundcube makes use of MySQL to retailer the data for working the online consumer (not your emails). On this part, it’s worthwhile to inform Roundcube the right way to entry the database that you just arrange in Step 4. You’ll want the database person, person password, and database identify you created beforehand.

  • It ought to be already set, however choose MySQL from the Database kind pull down menu.
  • Enter localhost for the Database server.
  • Enter the database identify, roundcubemail, within the Database identify discipline.
  • Enter the database person, roundcube, within the Database person identify discipline.
  • For the Database password discipline, enter the password you outlined when creating the database in Step 4.
  • The final choice, db_prefix, isn’t required except you might be with utilizing a shared database with different apps. In that case then enter one thing like, rc_.

IMAP Settings

For this part, you’ll want the IMAP and SMTP settings to your electronic mail server. As a result of this tutorial makes use of Gmail for example, the Gmail settings are included beneath, however when you have your personal electronic mail supplier, they need to offer you the main points you want. Most electronic mail suppliers assist connections with or with out encryption. Be certain to keep away from utilizing non-secure connections by utilizing the SSL IMAP/SMTP URLs and ports.

  • Within the default_host discipline enter the IMAP server URL. When utilizing SSL connections, prefix the URL with ssl:// as an alternative of https://. For Gmail, enter ssl://imap.gmail.com.
  1. Subsequent is setting the default_port, which is the IMAP server port. SSL and non-SSL connections will use totally different ports, so be certain to make use of the SSL port. Gmail’s SSL IMAP port makes use of 993.
  2. The sphere username_domain is a comfort choice for electronic mail suppliers that use a full electronic mail handle because the username. This discipline is non-obligatory. Getting into a website — not the complete electronic mail — will mean you can login to Roundcube with simply your identify, earlier than the @, as an alternative of the entire electronic mail. For instance, coming into gmail.com within the discipline will permit person@gmail.com to log into Roundcube with person.
  3. Be certain the auto_create_user test field is chosen. If it’s unchecked, Roundcube received’t create a person in its personal database, which is able to forestall you from logging in.
  4. For now, go away all the *_mbox fields, like sent_mbox, with their default values. This may be up to date later within the Roundcube UI, and most electronic mail purchasers use these folder names anyway.

SMTP Settings

The SMTP server is the a part of electronic mail that sends emails. Very like the IMAP server part, we’ll use the SSL URL and port, and Gmail for reference.

  1. Enter the SMTP server handle within the smtp_server discipline. Gmail’s SMTP server is ssl://smtp.gmail.com.
  2. Enter the SSL SMTP server port within the smtp_port discipline. The SSL port for Gmail is 465.
  3. As a result of SMTP and IMAP are two separate companies, they each want a username and password. Roundcube provides us the choice to make use of the IMAP username and password set above so we don’t should set it once more right here. This implies it’s worthwhile to go away the fields beneath smtp_user/smtp_pass clean and test the field subsequent to Use the present IMAP username and password for SMTP authentication.
  4. Lastly make it possible for the checkbox for smtp_log is checked.

Show settings & person prefs

We’ll go away all of those choices with their default values. If you wish to customise your Roundcube set up to be in a unique language than the working system it’s working on, set it manually by clicking the RFC1766 hyperlink on the configuration web page and updating the language discipline.

Plugins

Roundcube’s plugin assist is what actually makes this webmail consumer stand out. Beneath are a great set of defaults you possibly can set up. All plugins are non-obligatory, i.e,. they aren’t obligatory to make use of Roundcube, however the record beneath is an effective set to make the expertise both simpler or safer.

Check out the descriptions for every plugin and set up whichever you want. Should you don’t choose a plugin right here, you possibly can all the time set up it later. This simply pre-configures Roundcube with these plugins.

  • archive: Provides you an Archive button, much like how Gmail works.
  • emoticons: Merely makes it simpler to make use of emoticons in emails.
  • enigma: Permits GPG electronic mail encryption. We’ll go into element on the right way to configure this in our Roundcube security tutorial.
  • filesystem_attachments: A core plugin to permit saving attachments to the Roundcube server quickly when composing or saving a draft electronic mail.
  • hide_blockquote: Hides the quoted portion of replied emails to maintain the UI cleaner.
  • identity_select: When you’ve got a number of electronic mail addresses (identities), it means that you can simply choose them whereas composing an electronic mail.
  • markasjunk: Permits marking an electronic mail as spam and have it moved to your Spam folder.
  • newmail_notifier: Makes use of your browser notification system to provide you with a warning to new emails.

Eventually, that’s all the configuration. Press the UPDATE CONFIG button on the backside of the web page to save lots of your settings. Let’s check that all the pieces works subsequent.

Step 6 — Testing the Roundcube Configuration

After you replace the configuration, the web page will refresh and also you’ll see a yellow data field on the prime of the web page which says The config file was saved efficiently into RCMAIL_CONFIG_DIR listing of your Roundcube set up.

From right here, click on on the CONTINUE button to check your configuration. Just like the dependency test web page, if there are not any errors, you’ll see a inexperienced OK marker on each line. If not, return and double test what you entered.

To check the remainder of the configuration, put in your IMAP and SMTP username and password within the Take a look at SMTP config and Take a look at IMAP config sections, then click on Ship check electronic mail and Test login, respectively. If a check is profitable, the web page will reload and also you’ll see the inexperienced ‘OK’ beneath the part you examined.

When you’ve checked each SMTP and IMAP connections and each are inexperienced, then it’s time to leap again into your SSH session and take away the installer listing. It will forestall another person to generate a brand new config and override the right settings.

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

Now you possibly can go to your Roundcube occasion utilizing your server’s IP or your area identify, log in, and test your electronic mail.

Conclusion

With Roundcube, you possibly can have the function set and look of a local desktop consumer with the flexibleness of a webmail consumer. You have got a completely purposeful set up now, however there are some further steps you must take to be sure you’re absolutely safe (like including HTTPS assist and utilizing GPG encryption to your electronic mail).

Related Posts

How to Install CouchDB on Ubuntu 21.04 Linux Operating System

How to Install CouchDB on Ubuntu 21.04 Linux Operating System

The CouchDB is an open-source database system, managed by the Apache Software Foundation. It is fault-tolerant, and schema-free NoSQL database management system.   CouchDB store data in document or files with JSON data structure. Each document contains fields and...

How to add swap space on Ubuntu 21.04 Operating System

How to add swap space on Ubuntu 21.04 Operating System

The swap space is a unique space on the disk that is used by the system when Physical RAM is full. When a Linux machine runout the RAM it use swap space to move inactive pages from RAM. Swap space can be created into Linux system in two ways, one we can create a...

How to Install Nginx on Ubuntu 21.04 Server

How to Install Nginx on Ubuntu 21.04 Server

Nginx is the most potent, open-source, and a high-performance Web server. It can work as a reverse proxy server also, nowadays, is used by most of the most significant websites on the internet. People pronounced “engine x” for Nginx; it is the hot choice for every...

How to Install VirtualBox on Ubuntu 21.04 Linux

How to Install VirtualBox on Ubuntu 21.04 Linux

VirtualBox is an Open Source tool, known as a cross-platform virtualization application or software. It used to run multiple operating systems or virtual machines simultaneously on a single hardware. In this VirtualBox installation tutorial, we will explain the...

Follow Us

Our Communities

More on Ubuntu

The Ultimate Managed Hosting Platform
Load WordPress Sites in as fast as 37ms!

0 Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

1 × five =

Shares