How to Install ViMbAdmin on FreeBSD Latest

ViMbAdmin is a user-friendly web-based interface for managing virtual mail domains, accounts, and aliases using the popular mail server software Postfix and Dovecot. In this tutorial, we will walk you through the process of installing ViMbAdmin on FreeBSD Latest.

Prerequisites

Before you begin, make sure your FreeBSD system is up to date by running the following commands:

# pkg update && pkg upgrade

You will also need to have a web server installed on your system. In this tutorial, we will be using Apache, but you are free to use any other web server of your choice.

Step 1: Installing PHP Modules and Dependencies

ViMbAdmin is written in PHP and requires several PHP modules to work. To install all necessary PHP modules and their dependencies, run the following command:

# pkg install php73 php73-curl php73-ldap php73-mbstring php73-mysql php73-json php73-filter php73-zip php73-xml php73-tokenizer

Additionally, ViMbAdmin requires the Composer Dependency Manager for PHP to be installed. Run the following command to install Composer:

# pkg install composer

Step 2: Downloading and Installing ViMbAdmin

To download and install ViMbAdmin, follow the steps below:

  1. Create a new directory for storing the ViMbAdmin files:

    # mkdir /usr/local/www/vimbadmin/
    
  2. Change into the newly created directory:

    # cd /usr/local/www/vimbadmin/
    
  3. Use Git to clone the ViMbAdmin repository:

    # git clone https://github.com/opensolutions/ViMbAdmin.git .
    
  4. Run the composer install command to install ViMbAdmin and its dependencies:

    # composer install --no-dev --optimize-autoloader
    
  5. Copy the configuration file:

    # cp app/config/config.local.php.dist app/config/config.local.php
    

Step 3: Configuring ViMbAdmin

Now that you have installed ViMbAdmin, it’s time to configure it to work with your mail server.

  1. Open the configuration file that you just copied:

    # nano app/config/config.local.php
    
  2. Modify the MySQL database connection settings to match your environment:

    'doctrine' => [
        'connection' => [
            'orm_default' => [
                'driverClass' => Pdo::class,
                'params' => [
                    'host' => 'localhost',
                    'port' => '3306',
                    'user' => 'vimbadmin_user',
                    'password' => 'YOUR_PASSWORD',
                    'dbname' => 'vimbadmin_db',
                    'charset' => 'utf8mb4',
                    'driverOptions' => [
                        1002 => "SET NAMES 'UTF8'"
                    ]
                ]
            ]
        ]
    ]
    
  3. Modify the ViMbAdmin application settings:

    'vimbadmin' => [
        'site_name' => 'Your Site Name',
        'default_domain' => 'example.com',
        'default_aliases' => ['postmaster', 'abuse', 'webmaster'],
        'admins_extra' => [],
        'mbox_format' => '',
        'quota_enable' => 'LDAP',
        'quota_format' => '',
        'quota_service_class' => '',
        'quota_service_url' => '',
        'capability_limit' => 'mailbox',
        'relay_domains' => [],
        'create_mailboxes' => true,
        'extauth_ad_key' => '',
        'extauth_ad_domain' => '',
        'extauth_ad_auto_create' => false,
        'extauth_ad_recursive_alias_search' => true,
        'extauth_sql_auto_create' => false,
        'extauth_sql_hashed_password' => true,
        'extauth_sql_recursive_alias_search' => false,
        'extauth_sql_host' => '',
        'extauth_sql_dbname' => '',
        'extauth_sql_username' => '',
        'extauth_sql_password' => '',
        'extauth_sql_user_table' => '',
        'extauth_sql_username_field' => '',
        'extauth_sql_password_field' => '',
        'extauth_sql_crypt_prefix' => '{PLAIN}',
        'extauth_sql_attr_login' => '',
        'extauth_sql_attr_fullname' => '',
        'extauth_sql_attr_email' => '',
        'extauth_dovecotpw_min_length' => 64,
        'extauth_dovecotpw_nocreate' => true,
        'extauth_dovecotpw_path' => '',
    ]
    
  4. Save and close the file when you are finished.

Step 4: Configuring Apache for ViMbAdmin

Now that you have installed and configured ViMbAdmin, you need to configure Apache to serve the web pages.

  1. Create a new virtual host file for ViMbAdmin:

    # nano /usr/local/etc/apache24/Includes/vimbadmin.conf
    
  2. Add the following lines to the file:

    <Directory "/usr/local/www/vimbadmin/public/">
        AllowOverride All
        Require all granted
    </Directory>
    
    <VirtualHost *:80>
        DocumentRoot "/usr/local/www/vimbadmin/public/"
        ServerName mail.example.com
        
        <Directory "/usr/local/www/vimbadmin/public/">
            AllowOverride All
            Require all granted
        </Directory>
    
        # Log settings
        ErrorLog "/var/log/httpd/vimbadmin_error.log"
        CustomLog "/var/log/httpd/vimbadmin_access.log" combined
    </VirtualHost>
    
  3. Save and close the file.

  4. Restart Apache:

    # service apache24 restart
    

Step 5: Accessing ViMbAdmin

At this point, you should be able to access ViMbAdmin by visiting http://mail.example.com/ in your web browser, assuming you have set up DNS properly or have modified the hosts file on your computer.

When you visit the ViMbAdmin URL for the first time, you will be prompted to set up a superadmin account. Follow the instructions on the screen to complete the setup process.

Congratulations! You have successfully installed and configured ViMbAdmin 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!