Installing 3CX v15 on Azure with Debian

I spent hours trying to sort out how to install 3CX on Microsoft’s Azure platform. Even though Microsoft Azure has a Debian 8.0 Jessie image, things do not quite go to plan. Also be aware, this isn’t officially supported, and as this post will show, we know why.

Here we go.

    1. Create a new Debain 8 instance in Azure. Configure this however you like.
    2. Once installed, SSH to your new instance.
    3. Once logged in, run the following commands:
      wget -O- | apt-key add -
      echo "deb /" | tee /etc/apt/sources.list.d/3cxpbx.list
      apt-get update
      apt-get install 3cxpbx

      Install all the things.

    4. Once installed, you will see the following. I suggest the web method
    5. You will also need to open this port on Azure
    6. Now we are in business. BUT YOU ARE GOING TO RUN IN TO A BIG ISSUE. This is to do with the default template with the postgres database. If you don’t fix it, you will get the following error (text included for Google searches
      System.Exception: Error in CreatingCloudServerManagementDatabase.sql: 22023: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII) ---> Npgsql.PostgresException: 22023: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII) at Npgsql.NpgsqlConnector.DoReadMessage(DataRowLoadingMode dataRowLoadingMode, Boolean isPrependedMessage) at Npgsql.NpgsqlConnector.ReadMessageWithPrepended(DataRowLoadingMode dataRowLoadingMode) at Npgsql.NpgsqlDataReader.NextResultInternal() at Npgsql.NpgsqlDataReader.NextResult() at Npgsql.NpgsqlCommand.Execute(CommandBehavior behavior) at Npgsql.NpgsqlCommand.ExecuteScalarInternal() at PostInstall.DBConnection.ExecuteScriptInternal(NpgsqlConnection connection, String sqlQuery, IDictionary`2 parameters) at PostInstall.DBConnection.ExecuteScript(String sqlQuery, IDictionary`2 parameters) at _3CXCloudDBManager.DbConnectionExtensions.ExecuteScript(IDBConnection connection, Object configurationStructure, String scriptText, Boolean asResourceName) --- End of inner exception stack trace --- at _3CXCloudDBManager.DbConnectionExtensions.ExecuteScript(IDBConnection connection, Object configurationStructure, String scriptText, Boolean asResourceName) at _3CXCloudDBManager.CloudDBManager.CreateCloudServerManagementDatabase(IDBConnection superuser, CloudServerManagementDatabaseConfiguration configuration) at PostInstall.SetupExecutor.CreateDatabase(Action`1 stateChanged) at PostInstall.SetupExecutor.ExecuteSetup(SetupSettings setupSettings, Action`1 stateChanged) at PbxWebConfigTool.PbxSetupService.CreatePbxInternal(SetupSettings settings)


    7. Let’s fix this. Trying to login to psql is going to give you an error. So you need to type the following:
      sudo su - postgres
    8. Type psql and enter the followin
       UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';
      DROP DATABASE template1;
      UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';
      \c template1


    9. Now run through the web setup on http://yourip:5015 and you will no longer get the error

If this saved you a huge amount of pain, please leave a comment 🙂

12 thoughts on “Installing 3CX v15 on Azure with Debian”

  1. Wonderful.
    As you mentioned, this saved me lots of pain 🙂
    There’s just a little mistake at the end of the SQL-COmmands: this should be \q instead of /q

    Did you send this to 3CX’s support also?


      1. If you dont mind i can email Yilmaz who is incharge of reselelrs and refer him to the post on the forum so he can let the developers know.

Leave a Reply