HI ! HOW would I clone (make a baseline/template) FreePBX 17 on ProxMox so not to have to reinstall from scratch for each new client ?
So, We run ProxMox in a cluster (3+ years now) and have a pile of VM’s on it. This included (2) FreePBX systems up and running. I have done various clones before, never had an issue, till today.
The other day I went to create a new VM to install FreePBX 17, And I swear it took upwards of 2+ hours to do the fresh install and run updates, etc. This with even giving it multiple cores and a pile of RAM.
Today, I went to set up another clients FreePBX, and thought, I will just clone the most recent VM since it is new and relatively clean, and update with the new client info. I cloned the VM, but it would not start. The console kept getting errors of “Failed tp start apache2.servie - The Apache HTTP Server.” I finally got it to work by resetting the network adapter etc, but had to tinker with it for about 30 minutes. which sort of defeats the “speed” of just cloning it.
So… what would be the cleanest way to make a template and clone it ?
Figure out how to clone first with something simpler like a fresh a Debian install. I don’t easily remember what steps I took to provide a useful guide here, it was a while ago
You’ll want to clone before the administration creation page is completed.
Also, it’s important to run a script to handle the following, along with updates, and a couple of reboots for the changes to take effect. This extract is copied directly from our website but should help:
AMI Credentials
The Asterisk Manager Interface username and password are randomised. 15-character alphanumeric username, 30-character alphanumeric password. Set via fwconsole setting so all config files are updated consistently.
ARI Credentials
The Asterisk REST Interface username and password are randomised. ARI is exposed via HTTP and is the most security-critical interface to protect. Each instance gets unique credentials.
Database Credentials
The FreePBX database user password is randomised and written back into /etc/freepbx.conf. A 24-byte base64 password is generated via openssl rand, applied to the freepbxuser MySQL account, and the new value is patched directly into freepbx.conf. A live connection test confirms FreePBX can authenticate before provisioning continues. If the test fails, the script exits immediately rather than continuing with a broken system — a hard fail-safe at the most critical point in provisioning.
I use a template where FreePBX is somewhat configured but is not registered yet with Sangoma. You’ll need to update network settings in /etc/network/interfaces, /etc/resolv.conf, and hostname info in /etc/hosts and /etc/hostname. As kiernoby mentioned, you’ll need to update some creds. After that, you should be good to go.
Kind of missing the network setup for FreePBX/Asterisk. But has anyone really compared these two options?
Spin up fresh install, takes about 20-30 minutes then you have to do the standard setup.
OR
Install a clone, take about 20-30 minutes to make sure everything has been audited correctly. Hope you have missed anything. Do the standard setup.
What time you save on the install process is immediately lost because you have to do in and redo the system level stuff and make sure everything is adjusted for this particular install. Why isn’t something like Ansible or even cloud-init in this discussion? You can create playbook/configs that do all this on a fresh install for you without having to worry about auditing the install afterwards.
Like I said, the install of 17 “seems” to take about 2 hours now. I KNOW it was more than an hour, not just 30 minutes. While it was going i went and made dinner, cooked a steak and it was still not done when I was eating. Since we have a cluster, the networking is handled and we route an external IP to each FreePBX instance, so that gets done regardless. And we have high speed systems, the clone takes only a few minutes, Maybe 5 to 10. Re-Adjusting the internals of the FreePBX VM (the config files) this fist time took me about 30 minutes to do, because I was not sure what needed done and it was my first time doing that, but now that i know what to change it can go much faster. I could probably do it again in less than 5 this time.
But Yes, I took a fully registered VM and cloned it. I will have to try it with an Installed instance, but before it is registered.
Can you clarify ? Do you mean before I do the first login on the UI ?
Are you talking a full OS install? Because the FreePBX install is making sure a bunch of packages are installed, adding a repo and then downloads framework and runs the installer which installs all the modules.
Don’t you have a Debian 12 template that spins up the instance pretty fast?
The Heqet ISO works very well on Proxmox, might be worth a try if you want something faster, or at least lower touch. Although it doesn’t speed up the FreePBX script itself.
That’s not just “part of the problem”, it’s a BIG part of it. They should be spinning up their VMs with a Debian 12 cloud instance. If they “template” that, they’d be spinning up the entire VM in seconds
Like @BlazeStudios said, this is a major part of the problem. You should have a cloud-init file or some kind of Proxmox automation to spin up a Debian 12 VM from a Debian 12 cloud image (qcow2 format used by Proxmox). I have a copy of it downloaded from https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-amd64.qcow2 and saved on my Proxmox instance and spin up a new VM and FreePBX install from that. Massive time saver especially if you know how to automate the install using cloud-init