Virtual Mailbox Administration

The ViMbAdmin project (vim-be-admin) provides a web-based virtual mailbox administration system to allow mail administrators to easily manage domains, mailboxes, and aliases.

ViMbAdmin was written in PHP using our own web application framework which includes the Zend Framework, the Doctrine ORM and the Smarty templating system with JQuery and Bootstrap.

Project Link: https://github.com/opensolutions/ViMbAdmin

Install required packages and dependencies:

yum install php-cgi php-mcrypt php-memcache php-mysql php-json memcached git subversion git

PHP composer can be installed via:

cd /tmp
wget https://getcomposer.org/installer
php installer
mv composer.phar /usr/local/bin/composer

Set the timezone in /etc/php.ini  such as:

date.timezone="Asia/Dacca"

and restart apache

service httpd restart

Installation

Log into the server where you wish to install ViMbAdmin. In this document, I am going to assume your install path is /var/www/html/vimbadmin I will reference this using. $INSTALL_PATH You can thus copy and paste commands if you set the following appropriately:

export INSTALL_PATH='/var/www/html/vimbadmin'

You can install ViMbAdmin in a number of ways. In all cases you need PHP Composer installed (see requirements above).

  1. Via PHP Composer:
    composer create-project opensolutions/vimbadmin $INSTALL_PATH -s dev

    Some time you dependency error for php like:

    Running composer as root/super user is highly discouraged as packages, plugins and scripts cannot always be trusted
    Installing opensolutions/vimbadmin (dev-master dfc782e8d7fc0f525bf6fc7b4f17626a73611924)
     - Installing opensolutions/vimbadmin (dev-master master)
     Cloning master
    
    Created project in /var/www/html/vimbadmin
    Loading composer repositories with package information
    Installing dependencies (including require-dev) from lock file
    Your requirements could not be resolved to an installable set of packages.
    
    Problem 1
     - Installation request for doctrine/cache v1.6.0 -> satisfiable by doctrine/cache[v1.6.0].
     - doctrine/cache v1.6.0 requires php ~5.5|~7.0 -> your PHP version (5.4.16) does not satisfy that requirement.
     Problem 2
     - Installation request for doctrine/common v2.6.1 -> satisfiable by doctrine/common[v2.6.1].
     - doctrine/common v2.6.1 requires php ~5.5|~7.0 -> your PHP version (5.4.16) does not satisfy that requirement.
     Problem 3
     - doctrine/common v2.6.1 requires php ~5.5|~7.0 -> your PHP version (5.4.16) does not satisfy that requirement.
     - doctrine/dbal v2.5.4 requires doctrine/common >=2.4,<2.7-dev -> satisfiable by doctrine/common[v2.6.1].
     - Installation request for doctrine/dbal v2.5.4 -> satisfiable by doctrine/dbal[v2.5.4].

    To resolve this type of error install required PHP version on your system and run the command again:

    [root@ns1 vimbadmin]# composer install --dev
    Running composer as root/super user is highly discouraged as packages, plugins and scripts cannot always be trusted
    You are using the deprecated option "dev". Dev packages are installed by default now.
    Loading composer repositories with package information
    Installing dependencies (including require-dev) from lock file
     - Installing doctrine/lexer (v1.0.1)
     Downloading: 100%
    
    - Installing doctrine/inflector (v1.1.0)
     Downloading: 100%
    
    - Installing doctrine/collections (v1.3.0)
     Downloading: 100%
    
    - Installing doctrine/cache (v1.6.0)
     Downloading: 100%
    
    - Installing doctrine/annotations (v1.2.7)
     Downloading: 100%
    
    - Installing doctrine/common (v2.6.1)
      Downloading: 100%
    
    - Installing symfony/polyfill-mbstring (v1.2.0)
     Downloading: 100%
    
    - Installing symfony/console (v2.8.7)
     Downloading: 100%
    
    - Installing doctrine/dbal (v2.5.4)
     Downloading: 100%
    
    - Installing doctrine/orm (v2.4.8)
     Downloading: 100%
    
    - Installing zendframework/zendframework1 (1.12.18)
     Downloading: 100%
    
    - Installing komola/bootstrap-zend-framework (dev-master f81b60c)
     Cloning f81b60c1f477f4fbe4266b6d811a3eff9491f285
    
    - Installing opensolutions/minify (1.0.0)
     Downloading: 100%
    
    - Installing opensolutions/oss-framework (dev-master b3d669a)
     Cloning b3d669a81f8214032a70e594472ece9fe9322fe2
    
    - Installing smarty/smarty (v3.1.29)
     Downloading: 100%
    
    symfony/console suggests installing psr/log (For using the console logger)
    symfony/console suggests installing symfony/event-dispatcher ()
    symfony/console suggests installing symfony/process ()
    doctrine/orm suggests installing symfony/yaml (If you want to use YAML Metadata Mapping Driver)
    Generating autoload files

    At the end of this process, the composer will ask you:

    Do you want to remove the existing VCS (.git, .svn..) history?*

    Choose no.

  2. Via Git clone:
    git clone https://github.com/opensolutions/ViMbAdmin.git $INSTALL_PATH
    cd $INSTALL_PATH
    composer install --dev
  3. Via tarball (this method is discouraged as it will make updating more difficult): Find the latest release of ViMbAdmin from GitHub here. Find the URL of the tar.gz bundle and (changing filenames as appropriate):
    cd $(dirname $INSTALL_PATH)
    VIMBADMIN_VERSION=3.0.12
    wget https://github.com/opensolutions/ViMbAdmin/archive/${VIMBADMIN_VERSION}.tar.gz
    tar zxf ${VIMBADMIN_VERSION}.tar.gz
    mv ViMbAdmin-${VIMBADMIN_VERSION} $INSTALL_PATH
    cd $INSTALL_PATH
    composer install
    

File System Permissions

If you plan to run under Apache / another web server, ensure you set the ownership on the $INSTALL_PATH/var/directory appropriately.

chown -R apache $INSTALL_PATH/var

Database Setup

ViMbAdmin requires a backend database. We use the Doctrine2 DBAL and ORM so, in theory, any of the databases that Doctrine2 DBAL supports should work fine. We tend to use MySQL / MariaDB exclusively for testing and production so these instructions relate to that.

Log into your MySQL (or other) database and create a new user and database:

CREATE DATABASE vimbadmin;
GRANT ALL ON vimbadmin.* TO 'vimbadmin'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

Configuration

Vimbadmin ship a stock/reference configuration file. You need to copy this as follows:

cp $INSTALL_PATH/public/.htaccess.dist $INSTALL_PATH/public/.htaccess

cp $INSTALL_PATH/application/configs/application.ini.dist $INSTALL_PATH/application/configs/application.ini

You now need to set your database parameters in the $INSTALL_PATH/application/configs/application.inifile. You’ll find these near the top and here is an example:

resources.doctrine2.connection.options.driver = 'pdo_mysql'
resources.doctrine2.connection.options.dbname = 'vimbadmin'
resources.doctrine2.connection.options.user = 'vimbadmin'
resources.doctrine2.connection.options.password = 'password'
resources.doctrine2.connection.options.host = 'localhost'

Please see Configuration page and work your way through your andapplication.ini update the settings as appropriate. In particular, you need to configure a mail relay.

Database Creation

Now that your configuration is set and you have set up a database and user in MySQL, you need to create the database schema:

cd $INSTALL_PATH
./bin/doctrine2-cli.php orm:schema-tool:create

If all goes well, you should see:

$ ./bin/doctrine2-cli.php orm:schema-tool:create
ATTENTION: This operation should not be executed in a production environment.

Creating database schema…
Database schema created successfully!

Web Server Set-Up

Apache2

You need to tell Apache where to find ViMbAdmin and what URL it should be served under. In this example, we’re going to serve it from /vimbadmin (e.g. www.example.com/vimbadmin). As such, we create an Apache configuration block as follows on our web server:


Alias /vimbadmin /var/www/html/vimbadmin/public

<Directory /var/www/html/vimbadmin/public>
    Options FollowSymLinks
    AllowOverride FileInfo

    # For Apache <= 2.3:
    Order allow,deny
    allow from all

    # For Apache >= 2.4
    # Require all granted    
</Directory>

You may need to edit the above if you’re using a different URL or file system path.

Ensure mod_rewrite is enabled:

a2enmod rewrite

Restart Apache and you can now browse to your new installation.


Welcome to Your New ViMbAdmin Installation

You should now be greeted with a page welcoming you. If you didn’t set the security salt above, then the installer will provide random strings for these. Place this invimbadmin/application/configs/application.ini as instructed before continuing. If you did set it, then enter it in the Security Salt input box.

This is a security step to ensure that only the person performing the installation can create a super administrator.

Now enter a username (which must be an email address) and a password.

Once you click save, you’re done! Log in and work away.

Facebook Comments

One Reply to “Install ViMbAdmin for Postfix Virtual Mail Administration tool on CentOS/RHEL 6.x/7.x”

Leave a Reply

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