[How-to] Host PBXact or PBXact SaaS on Azure
This step-by-step guide aims to help anyone install and start using PBXact or PBXact SaaS on the Azure hosting platform.
NOTICE
While no incompatibilities between the FreePBX ISO and Azure's hosting platform have been detected at the time of writing this guide, Sangoma does not officially Support hosting FreePBX/PBXact on platforms other than Sangoma Cloud. This means that, while Sangoma Support Services may still be accessed, any platform-related issue will not be covered.
PRE-REQUISITES
Download FreePBX ISO file from Download | FreePBX - Let Freedom Ring . For this guide, the FreePBX 15 ISO will be used
Enable or Download & Install the preferred Virtual Machine engine of your choice that supports VHD virtual hard disk drive file format. For this guide we will use Hyper-V (recommended if possible)
OPTIONAL PRE-REQUISITES FOR QUICKER UPLOAD OF THE VIRTUAL HARD DISK DRIVE FILE
Download & Install GitHub
Download & Install Go
Using Go, Download & Install Azure VHD utilities via command line
Create a Virtual Machine and Install the FreePBX ISO on it
Create the local VM
The following Steps are done inside the Hyper-V Manager application:
Create the Virtual Machine:
Action > New > Virtual Machine...Specify Name and Location: give your VM any Name (example: PBXact)
Specify Generation: Generation 2
Assign Memory: depends on your PBX processing needs (number of users, concurrent calls, etc.). As examples of general approximates: 2GB could prove to be enough for up to 25 users, while 4GB could prove to be enough for up to 100 users
Connect Virtual Hard Disk: set the Size of the virtual hard disk drive file
Note: the size will depend on your PBX storage needs, 10GB minimum are recommended for basic PBXact operation. If calls are to be recorded, the disk size would need to be accordingly bigger, considering that each minute of recorded SIP audio consumes ~1MB of disk space. The size here should be in accordance with Azure's plan which we'll select later
Installation Options: for the Media, select the previously downloaded FreePBX .iso file
Click Finish to create the VM
Edit the Settings of the VM:
right-click on the VM name > Settings...Security: make sure the option "Enable Secure Boot" is disabled
Click OK to save an apply the changes
Install FreePBX onto the local VM
Start the VM: double-click on the VM name and then click on Start in the VM window that will be displayed
The first screen of the FreePBX installation will get displayed, select:
FreePBX 15 Advanced Installation > Advanced Installation with Normal Video > Advanced Install with Asterisk 16 via Standard VideoThe installation UI will load up and get displayed:
INSTALLATION DESTINATION
make sure the hard disk drive is selected (this is the default) and click Done
select partition scheme as: Standard Partition
Click here to create them automatically
select the swap partition and press the "-" sign to delete it
click on Done twice
Accept Changes
Begin Installation
The installation will begin; while the installation is running set the root password and take note of it
Once the installation is complete, click on Reboot on the lower right corner of the VM's screen
Adjust the FreePBX VM for Azure
Log into FreePBX's Linux console as root user (use the password set in step 3.i. above)
FreePBX's banner/MOTD will get displayed showing its DHCP-obtained IP address, use it to login rather via SSH
Once inside the SSH session as root user, execute all of the following commands one by one in order (adjust the 2048 in line 16 accordingly depending on amount of swap memory, in MBs, appropriate for your environment):
echo -e "NETWORKING=yes\nHOSTNAME=localhost.localdomain" > /etc/sysconfig/network echo -e "DEVICE=eth0\nONBOOT=yes\nBOOTPROTO=dhcp\nTYPE=Ethernet\nUSERCTL=no\nPEERDNS=yes\nIPV6INIT=no\nNM_CONTROLLED=no" > /etc/sysconfig/network-scripts/ifcfg-eth0 ln -s /dev/null /etc/udev/rules.d/75-persistent-net-generator.rules echo -e "\n\n[openlogic]\nname=CentOS-\$releasever - openlogic packages for \$basearch\nbaseurl=http://olcentgbl.trafficmanager.net/openlogic/\$releasever/openlogic/\$basearch/\nenabled=1\ngpgcheck=0" >> /etc/yum.repos.d/CentOS-Sources.repo yum clean all sed -i 's/.*GRUB_CMDLINE_LINUX.*/GRUB_CMDLINE_LINUX="rootdelay=300 console=ttyS0 earlyprintk=ttyS0 net.ifnames=0"/' /etc/default/grub grub2-mkconfig -o /boot/grub2/grub.cfg sed -i 's/.*add_drivers+.*/add_drivers+=" hv_vmbus hv_netvsc hv_storvsc "/' /etc/dracut.conf dracut -f -v yum install python-pyasn1 WALinuxAgent -y systemctl enable waagent sed -i 's/.*ResourceDisk.Format.*/ResourceDisk.Format=y/' /etc/waagent.conf sed -i 's/.*ResourceDisk.Filesystem.*/ResourceDisk.Filesystem=ext4/' /etc/waagent.conf sed -i 's/.*ResourceDisk.MountPoint.*/ResourceDisk.MountPoint=\/mnt\/resource/' /etc/waagent.conf sed -i 's/.*ResourceDisk.EnableSwap.*/ResourceDisk.EnableSwap=y/' /etc/waagent.conf sed -i 's/.*ResourceDisk.SwapSizeMB.*/ResourceDisk.SwapSizeMB=2048/' /etc/waagent.conf waagent -force -deprovision export HISTSIZE=0 poweroff
Convert the Disk Format and Type of the virtual hard disk file
Back again in the Hyper-V Manager application, enter to edit the Settings of the VM once again:
right-click on the VM name > Settings...Hard Drive:Edit
Choose Action: Convert
Choose Disk Format: VHD
Choose Disk Type: Fixed size
Configure Disk: set the Name of the virtual hard disk including the complete path before it
Note: take note of the complete location where the virtual hard disk file will get created and stored as it will be needed later (by default in Windows for example: C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\myhdd.vhd)
Click Finish to convert the virtual hard disk drive file
After a few moments, the virtual hard disk file will have the correct format and type for using it in Azure
Set up Azure
Prepare Azure for receiving the VM's hard disk drive file
The following Steps are done inside your Azure Portal:
Search for and open Storage accounts (not Storage accounts (classic)) and click on "Create storage account". Set the parameters similarly to the following:
Click Create
Once the Storage account has been created, open it: search for and open Storage accounts (not Storage accounts (classic)) and click on the storage account just created ("pbxactsan" in this example) in order to create the Container:
Click to open the Container just created ("pbxact-container" in this example), and then click on Upload in order to upload the virtual hard disk drive file of your local FreePBX VM machine (see note on step 2.b.i.3. above for the exact location of this file inside your local computer). After locating and selecting the file, click on the Upload blue button. The upload will begin.
IMPORTANT
A considerably faster method for uploading the virtual hard disk file (better transfer speeds as well as smaller file uploaded due to efficient compressing) is the following:
After meeting the OPTIONAL PRE-REQUISITES listed at the beginning of this guide, execute the following command in the command line (if using Windows, PowerShell is recommended over cmd)(change the parameters in italics accordingly):
C:\Go\bin\azure-vhd-utils\azure-vhd-utils.exe --verbose upload --localvhdpath 'C:\Users\Public\Documents\Hyper-V\Virtual hard disks\myhdd.vhd' --stgaccountname 'storageaccountname' --stgaccountkey 'ThEStoRagEacCountKEyOFYourazUreStORaGEacCoUNt==' --containername 'container_name' --blobname 'name_for_the_disk_file_to_receive_once_uploaded.vhd'
The Storage account key (stgaccountkey) is seen in the Azure Portal under: the Storage account > Access keys
Create Azure's Image using the uploaded virtual disk file and then Create the VM off of that Image
After uploading is complete, back in Azure Portal: search for and open Images and click on "Create image". Set the parameters similarly to the following (Browse for and Select the .vhd file just uploaded in the previous step):
Click Create
Once the Image has been created, open it: search for and open Images and click on the Image just created ("PBXact_image" in this example) in order to create the Virtual Machine:
Create the VM similarly as follows --- IMPORTANT: select the Size (plan) according to your PBX processing needs (number of users, concurrent calls, if the calls will use demanding features such as recording, queueing, transcoding, encryption, etc.).
As examples of general approximates: 2GB-1CPU could prove to be enough for up to 25 users doing up to 15 concurrent simple calls, while 4GB-2CPUs could prove to be enough for up to 100 users doing up to 60 concurrent simple calls. It all depends on the specific needs of each particular scenario.Note: remember the Username and Password set here as those credentials will be used the first time you'd want to access the console (SSH)
Click on "Review + create" and then on "Create"
After some minutes your VM will be completely created and ready to be used. To access it just search for and open Virtual machines and click on the Virtual machine just created ("PBXact15" in this example). An Overview of the VM will be displayed showing its assigned public IP address of your newly hosted PBX, use this IP for all communications (webUI and SSH access, SIP, Zulu Desktop, etc.).
Optional recommended steps
White list your Public IP address for all traffic coming from your public IP towards your newly created VM in Azure and remove all other public access:
Search for and open Virtual machines and click on the Virtual machine just created ("PBXact15" in this example)
Click on "Networking" and then on the "Add inbound port rule" button. Add the rule as follows (substitue 1.2.3.4 accordingly with the public IP address from where you are connecting to the hosted PBX VM):
After having confirmed the rule is working as expected, proceed to delete all other public rules (would be the other ones also with their Priority assigned within the 300s range):
Transform FreePBX to PBXact or PBXact SaaS
The final step is just to transform the FreePBX brand new installation into PBXact or PBXact SaaS. For this, just use your previously acquired PBXact/PBXact SaaS Deployment ID when activating this FreePBX instance: open an SSH session using the credentials set when creating the VM in Azure (step 4 just above) and execute the following command as root user:
sudo su |
(in order to change to root user)
fwconsole sysadmin activate depID_of_pbxact |
(change depID_of_pbxact accordingly to your PBXact/PBXact Saas Deplyment ID)
If, after the complete execution of the command above, the webUI would not complete or not yet reflect PBXact's style, execute the following additional commands:
and then, repeat the activate command if needed.