How To Install Roundcube on Ubuntu 22.04 LTS
In this tutorial, we will show you how to install Roundcube on Ubuntu 22.04 LTS. Email communication remains a cornerstone of modern business and personal interactions. While there are various email clients available, Roundcube offers a user-friendly web interface that simplifies access to your emails from any device with an internet connection.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the Roundcube webmail on Ubuntu 22.04. You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.
Prerequisites
- A server running one of the following operating systems: Ubuntu 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- Access the terminal on your Ubuntu system, where we’ll execute the commands for a seamless Roundcube installation.
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Roundcube.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Roundcube on Ubuntu 22.04 LTS Jammy Jellyfish
Step 1. Open the terminal and run the following commands to update your package lists and upgrade existing packages:
sudo apt update sudo apt upgrade
Step 2. Installing LAMP Stack.
The LAMP stack, consisting of Apache, MySQL, and PHP, provides a robust foundation for Roundcube. If you do not have LAMP installed, you can follow our guide here.
Step 3. Create a MySQL Database for Roundcube.
Access the MySQL command-line interface and execute the following commands to create a database and user:
mysql -u root -p CREATE DATABASE roundcubedb; CREATE USER 'roundcubeuser'@'localhost' IDENTIFIED BY 'your_strong_password'; GRANT ALL PRIVILEGES ON roundcubedb.* TO 'roundcubeuser'@'localhost'; FLUSH PRIVILEGES; EXIT;
Step 4. Installing Roundcube on Ubuntu 22.04.
Download Roundcube using wget
and move the files to the Apache web directory:
wget https://github.com/roundcube/roundcubemail/releases/download/1.6.5/roundcube-framework-1.6.5.tar.gz tar -zxvf roundcube-framework-1.6.5.tar.gz sudo mv roundcube-framework-1.6.5 /var/www/html/roundcube
Ensure correct permissions for Roundcube files and directories:
sudo chown -R www-data:www-data /var/www/html/roundcube/ sudo chmod -R 755 /var/www/html/roundcube/
Next, copy the sample configuration file and modify the database settings:
cd /var/www/html/roundcube/config cp config.inc.php.sample config.inc.php nano config.inc.php
Update the database settings in the configuration file:
$config['db_dsnw'] = 'mysql://roundcubeuser:your_strong_password@localhost/roundcubedb';
Step 5. Configure Apache for Roundcube.
Create a new virtual host configuration file for Roundcube:
sudo nano /etc/apache2/sites-available/roundcube.conf
Add the following configuration:
<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/roundcube <Directory /var/www/html/roundcube/> Options FollowSymLinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Enable the new configuration and restart Apache:
sudo a2ensite roundcube.conf sudo a2enmod rewrite sudo systemctl restart apache2
Step 6. Enabling HTTPS for Roundcube.
Securing your Roundcube installation with HTTPS is crucial to safeguard data transmission. In this guide, we’ll use Certbot, a tool from Let’s Encrypt, to obtain and install a free SSL certificate, ensuring a secure communication channel. Begin by installing Certbot and the Apache plugin:
sudo apt install certbot python3-certbot-apache
Run Certbot to obtain a certificate and automatically configure Apache:
sudo certbot --apache
Step 7. Configure Firewall.
Before proceeding, ensure you have administrative privileges and UFW installed. If not, install UFW using:
sudo apt install ufw
Allow traffic on the Apache web server port (default is 80 for HTTP and 443 for HTTPS):
sudo ufw allow 'Apache Full'
Now, enable UFW:
sudo ufw enable
Step 6. Accessing Roundcube Web Interface.
Open your web browser and navigate to https://your_server_ip/roundcube/installer/
to complete the Roundcube installation.
Congratulations! You have successfully installed Roundcube. Thanks for using this tutorial for installing the Roundcube webmail on the Ubuntu system. For additional help or useful information, we recommend you check the official Roundcube website.