Roundcube is a free and open-source webmail software that allows you to access your emails easily through the web interface.
Here's a tutorial to guide you on how to install Roundcube on FreeBSD latest:
Assuming that you have a fresh installation of FreeBSD, the first thing you need to do is to install the Apache web server and PHP. Run the following commands:
# pkg update
# pkg install apache24
# pkg install mod_php74
After installation, start Apache and enable it to start on system boot:
# sysrc apache24_enable=YES
# service apache24 start
Roundcube requires a database server to store its data. In this guide, we will use MariaDB. To install MariaDB, run the following command:
# pkg install mariadb103-server
Start the MariaDB server and enable it to start on boot:
# sysrc mysql_enable=YES
# service mysql-server start
When MariaDB is running, you need to secure it by running the following command:
# mysql_secure_installation
During the installation process, the script will ask you several questions. Answer the questions as shown below:
Next, create a new database and user for Roundcube:
# mysql -u root -p
MariaDB [(none)]> CREATE DATABASE roundcube;
MariaDB [(none)]> CREATE USER 'roundcube'@'localhost' IDENTIFIED BY 'your_password';
MariaDB [(none)]> GRANT ALL ON roundcube.* TO 'roundcube'@'localhost' IDENTIFIED BY 'your_password';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;
Now it's time to download and install Roundcube. Go to the Roundcube website and download the latest stable version of the software. You can use wget to download the file:
# cd /usr/local/www/
# wget https://github.com/roundcube/roundcubemail/releases/download/1.5.2/roundcubemail-1.5.2-complete.tar.gz
Extract the downloaded file and rename the directory to "roundcube":
# tar -xzvf roundcubemail-1.5.2-complete.tar.gz
# mv roundcubemail-1.5.2 roundcube
Change the ownership of the roundcube directory to the Apache user:
# chown -R www:www roundcube
To configure Roundcube, you need to edit the configuration files. Run the following commands:
# cd /usr/local/www/roundcube/config
# cp config.inc.php.sample config.inc.php
# vim config.inc.php
Find the following line:
$rcmail_config['default_host'] = 'localhost';
and replace "localhost" with your mail server hostname or IP address:
$rcmail_config['default_host'] = 'your_mail_server_hostname_or_ip';
Find the following line:
$rcmail_config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail';
Replace "roundcube" and "pass" with the username and password you created for the Roundcube database user:
$rcmail_config['db_dsnw'] = 'mysql://your_roundcube_db_username:your_password@localhost/roundcube';
Save and exit the file.
To access Roundcube from a web browser, you need to set up a virtual host. The following example shows how to set up a virtual host using Apache.
Create a new virtual host configuration file:
# cd /usr/local/etc/apache24/Includes/
# vim roundcube.conf
Paste the following configuration into the file:
<VirtualHost *:80>
ServerAdmin webmaster@example.com
DocumentRoot /usr/local/www/roundcube
ServerName webmail.example.com
<Directory /usr/local/www/roundcube>
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/roundcube_error.log
CustomLog /var/log/httpd/roundcube_access.log combined
</VirtualHost>
Save and exit the file.
Next, restart the Apache server:
# service apache24 restart
Open your web browser and navigate to the Roundcube URL. In this example, we used "webmail.example.com" as the virtual host. If everything is configured correctly, you should be able to see the Roundcube login page.
Congratulations! You have successfully installed Roundcube on FreeBSD latest.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!