본문 바로가기

FreeBSD/Tip

Setup Roundcube on FreeBSD


Setup Roundcube on FreeBSD

Paul Stamatiou wrote a HOW TO setup RoundCube webmail on your server. I decided to write the same HOWTO on setting up Roundcube on FreeBSD. RoundCube is a PHP/MySQL based webmail system with AJAX.

The Roundcube webmail software is available in FreeBSD ports. If you want to learn more about FreeBSD packages and ports, please read The FreeBSD Handbook, chapter 4.

The ports for Roundcube webmail is available in /usr/ports/mail/roundcube. To install roundcube, you will need to type the following (as root):

# cd /usr/ports/mail/roundcube
# make install clean

The ports system will install Apache, PHP4, and MySQL if you do not have them on your system. By default, roundcube is installed in /usr/local/www/roundcube/

Now, I’m going to map the http://localhost/roundcube/ to /usr/local/www/roundcube/. To do this you will need to open the apache configuration located in /usr/local/etc/apache or /usr/local/etc/apache2 (if you have apache2). Edit httpd.conf then copy and paste the following:


Alias /roundcube "/usr/local/www/roundcube/"

<Directory "/usr/local/www/roundcube">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Save the file and then restart apache: # apachectl restart

You now need to create a database for roundcube. Once you’ve created the database, you need to open config/db.inc and change the database setting:

$rcmailconfig['dbdsnw'] = 'mysql://username:secretpass@localhost/roundcube';

The format for the above line is db_provider://user:password@host/database.

Now, you want to edit main.inc.php file and change the mailhost setting with your IMAP server address. You can leave them blank, roundcube will display a textbox at login so users can enter the IMAP address manually.

$rcmailconfig['defaulthost'] = 'localhost';

Now, you need to import the database structure into your roundcube database. You can copy and paste them into phpMyAdmin or you can use the following command:

# cd /usr/local/www/roundcube/SQL
# mysql -u user -p database < mysql.initial.sql

All done, congratulation you have installed roundcube on your server. You can access your roundcube webmail on http://localhost/roundcube/ (You can change your localhost to your hostname).

You can now login with your username and password on your IMAP server.