When you're a startup, one thing that most have in common is having little to no budget. I would have to say that yet another thing most have in common is they don't want their customers to know that they're running on a shoestring budget. So giving out your personal cell phone numbers just isn't going to send the message your looking to send. You need one of those fancy phone greetings with a menu to send them to the right department. Even if every department is just you(I've been there).

So after looking to many options out there over the years, I would have to say the most bang for your buck is going to be the combination of 3 things(4 things if you count the fact that you may have to learn some stuff). Those three things are:

Before we begin, I do want to note that I assume that you are using a linux/unix based system. Meaning that if you are on a windows computer, my terminal commands may not work for you.

Let's Setup Our EC2 Instance

Before going any further you will need to click the Create an AWS Account to create your account.

*It's important to note that if your a new AWS user that you'll be able to get your instance under their free tier for the first year. Which is awesome!

After creating your account, you'll want to login to the Console, click Services in the navbar, and select EC2 from the Compute section.

EC2

Upon selecting EC2, you'll be in the EC2 Dashboard. Select the Launch Instance button to begin deploying the virtual server. (Ignore the nonsense about AWS Lightsail. You'll just run into a bunch of permissions issues and missing dependencies for OpenVBX if you go that route. Trust me.)

Step 1 is to choose an Amazon Machine Image. For this project we will choose Ubuntu.

Ubuntu

Step 2 we can leave at the usual default, Free tier eligible t2.micro. So just click the blue Review and Launch button in the bottom right corner.

t2.micro

That'll skip us all the way to Step 7 of the process where all you to do is hit the Launch button. Now a modal will pop up prompting you to select/create a key pair, which you will need in the coming steps. Create a new key pair with a name of your choice and click the Download Key Pair button to download the private key you just created.

Select key pair

Now select the Launch Instances button to start the new EC2 instance.

You will now see a Launch Status page. All you need to do is click the View Instances button in the bottom right of the screen.

Now you need to select your instance from the list of instances and write down the IPv4 Public IP as we'll need that when configuring the server to connect to serverpilot.

Now click the launch-wizard-2 security group to go to the Security Groups page and select the Inbound tab. Now select the Edit button and add HTTP/HTTPS to the inbound rules and click save.

inbound rules

Now let's configure our EC2 instance to work with ServerPilot. What we need to do is enable SSH login via password so ServerPilot can connect and configure the instance. This will all be done in the termial, so fire that puppy up.

You will need to navigate to the directory of your .pem file we downloaded earlier from the select key pair modal. Next you'll want to set correct permissions on the .pem file so it isn't insecure:

chmod 400 openvbx.pem*

*Keep in mind that you will replace openvbx.pem with the name of your file

Now let's ssh to our new instance:

ssh -i openvbx.pem ubuntu@<YOUR_PUBLIC_IP>

Now your terminal prompt should have changed to ubuntu@ip-XXX.XX.XX.XX. Which means you've successfully connected to your EC2 instance.

Now let's enable SSH login via password:

sudo vi /etc/ssh/sshd_config

This command will launch the sshd_config file in the VI editor. If you aren't familiar with VI editor, checkout this great beginners guide.

Now you need to change the values of PermitRootLogin and PasswordAuthentication to yes in the file and save the file.

PermitRootLogin yes
PasswordAuthentication yes

Now set a root user password:

sudo passwd root

Follow the prompts to set the root password. *Remember this password for ServerPilot

Last thing to do is restart the SSH service:

$ sudo service ssh restart

Let's Connect & Configure our EC2 instance with ServerPilot

Before ServerPilot, if I wanted to setup OpenVBX on an EC2 instance it was a lot of painful hours of getting dependencies/permissions right and setting up mysql via terminal on the instance. Which take it from me was horrible. Now with ServerPilot, all you have to do is connect up your instance with the Public IP address and the root password and it will setup your instance with whatever version of PHP you need, secures it with a firewall, sets up a pre-configured hosting environment, keeps everything up to date, and provides reporting and monitoring to boot. I liked that, and I'm sure you will too.

ServerPilot

They do offer paid options which allow for more advanced features, but for this project the free account works fine. So navigate to ServerPilot.io, click the Sign Up button, and let's get started.

After you sign up, you will be prompted to Connect a Server

Connect a Server

This is where you'll enter your Public IP that I told you to keep handy, and the Root Password you created in the last step of the EC2 Instance Section. You will also need to enter a SFTP Password that you will use with a newly created serverpilot user. Then just click the Connect to ServerPilot button and watch the magic happen.

That'll take 2-3 minutes to complete. After that you should see a green + Create App button. Go ahead and click it.

Create an App

When creating your OpenVBX app, make sure you select PHP 5.6 or you are going to run into problems with OpenVBX. Also select your EC2 instance from the server list. Now click Create App.

*Please take note that your app name has to be in all lowercase with no spaces unlike what is shown in the picture.

That will quickly create your app. Now click Databases so we can create the database OpenVBX will need during install.

Create Database

Type a name for your new database and you'll notice that a username and password generates while your typing. Before hitting create, write down this information as you won't be able to retrieve the password again.

Now click

Now let's go back to our terminal and ssh to our instance:

ssh -i openvbx.pem ubuntu@<YOUR_PUBLIC_IP>

Now your terminal prompt should have changed to ubuntu@ip-XXX.XX.XX.XX. Which means you've successfully connected to your EC2 instance.

Now we need to disable strict SQL mode in order for group notifications in OpenVBX to work. To do this we have to create disable_strict_mode.cnf:

touch /etc/mysql/conf.d/disable_strict_mode.cnf

sudo vi /etc/mysql/conf.d/disable_strict_mode.cnf

This command will launch the sshd_config file in the VI editor. If you aren't familiar with VI editor, checkout this great beginners guide.

Now you need to add the following values to the file and save the file.

[mysqld]
sql_mode=IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Now Restart MYSQL with this command:

sudo service mysql restart

Now for security reasons, let's disable SSH Root login:

sudo vi /etc/ssh/sshd_config

This command will launch the sshd_config file in the VI editor. If you aren't familiar with VI editor, checkout this great beginners guide.

Now you need to change the values of PermitRootLogin to no in the file and save the file.

PermitRootLogin No

Last thing to do is restart the SSH service:

$ sudo service ssh restart

Let's Install OpenVBX on our EC2 Instance

OpenVBX

OpenVBX is an Open Source Phone System built by and powered by twilio.

Before we start our install of OpenVBX, you will need to sign up for an account with twilio so we have the account SID and api key we'll need during the install. Sign Up Here.

After signing up, you need to grab the Account SID and Auth Token from your Twilio Dashboard.

Alright, now back to the terminal to download and extract OpenVBX on our instance.

ssh serverpilot@<YOUR_PUBLIC_IP>

Now navigate to the app we created in ServerPilot and download OpenVbx:

cd apps/openvbx
wget https://api.github.com/repos/twilio/OpenVBX/tarball/ -O openvbx.tgz

Move/rename the old public/ folder, extract OpenVBX, remove the archive, and rename it to public/:

mv public public.old
tar -xvzf openvbx.tgz
rm openvbx.tgz

Please note that this next command may be different for you because of the alphanumeric added after twilio-OpenVBX-. To check this just run a ls to see the appropriate name of the directory.

mv twilio-OpenVBX-7ed912a public

Now navigate to your Public IP to start the OpenVBX install process.

Check Server

Your screen should look just like the one pictured, go ahead and click the Next Button.

Configure Database

Now enter the database name, username, and password I told you to keep handy in the ServerPilot section and hit next.

Connect to Twilio

Type in your Account SID and Token from earlier in this section and then hit next.

Options

Here you enter the email you want OpenVBX to send notifications from. Then hit Next.

Type in your preferred account information. Then hit Install.

Installation Complete

That's it! Just log in with the credentials you just created and your ready to setup OpenVBX to suit your startup. One quick note is that you will have to switch to a paid twilio account before you could go to production with this phone system. Good Luck!

Logged In

If you got stuck and need some help at any point of this tutorial, please comment below and I'll give you a hand.