How to setup WHMCS on AWS LightSail using Runcloud

How to setup WHMCS on AWS LightSail using Runcloud

 First of all, if you are beginner and do not know what WHMCS is used for then this video is not for you. If you are looking to install WHMCS on a VPS server, please do watch this video. I have demonstrated AWS LightSail but the steps are pretty much same for all VPS servers. The reason that I am posting this video is simply because I couldn’t find one.

In this video tutorial, I am going to cover how to install WHMCS on AWS LightSail using Runcloud.io. We can also do this without Runcloud using LightSail LAMP but Runcloud makes things a lot better and easy to manage in long term. For this you have to pay $8/month to Runcloud or $15 if you plan to run multiple servers plus the cost of WHMCS license plus the cost of LightSail server, depending on what you choose. Even you could use Server Pilot or other similar platforms but I am going to demonstrate using Runcloud in this video. This is for intermediate level users, beginners may find it difficult. This process is going to take around 2 hours depending on your server and the level of experience. So please plan accordingly.

As you continue with this video, I assume that you might have a Reseller Hosting with someone or own a server. Before we get in to this, there are 4 prerequisites.

  1. A domain name – I am sure you already have one
  2. AWS Account, you might get 3 months of trial on some LightSail plans
  3. A Runcloud account at least with Basic Plan
  4. WHMCS software package. It is recommended that you download it in advance, unzip it and keep it ready. This might be a timing consuming process.

Step 1: Launch AWS LightSail Server & Configure

We are going to create a AWS account. In this video I will skip this step as most of you know how to do it. If you already have one, like me, just login to your AWS console. Click Services on top left corner, it will open up a Menu, under Compute section, click LightSail, it will open a fresh page.

Now click, “Create instance”, select your preferred location. Select the platform as Linux/Unix and click “OS Only” option and then select “Ubuntu 18.04” as the option. Now click, Change SSH key pair, create New and download the PEM file and keep it safe. If you wish to choose automatic snapshots, you may do so. This step is optional though. Select you desired server size, I recommend a minimum of 1 vCPU & 2GB of memory but 2 vCPU & 4 GB is recommended for most users. Now give an unique name to your instance, so that you can identify, if you run multiple servers. Allow sometime for the process to complete.

Now click on the name to view the server. I recommend that we assign a static IP before we proceed otherwise if you reboot the server, your IP will change. To do this, click Networking and then click create a static IP. Give a name to identify your static IP and then click Create. Now we have created and assigned the static IP to the server. Now click home on the top to see the list of servers, click on the server that you just created. Next, Click on Networking, now we have to add 2 rules in the IPv4 Firewall. First rule is to open the port 443, for the HTTPS to work. Second rule is to open the communication port 34210, which will be used by Runcloud.

Note: If you use Runcloud to create the LightSail server automatically, it might get rid of some steps here, but you should configure the static IP manually. In my opinion this model is easier than changing the static IP manually later.

Step 2: Create a Runcloud account and you will be given a 5 days Trail at the beginning. After logging in to the account, you will have to click “Connect to a new server” and choose “Amazon LightSail” as server provider and click provision type as “Connect via IP address”. If you click Build Server, it will create a new server in AWS LightSail, provided that you have already given the IAM credentials to Runcloud. As we have already created the server in AWS LightSail, we are going to “Connect via IP Address”

Now choose Nginx or Openlitespeed. In this tutorial, I am going to choose openlitespeed as it offers better speed. If you choose Nginx, choose Hybrid version of Apache + Nginx

Give a server name, it can be anything that you can identify. Now go back to LightSail, copy the Static IP and enter it here. Then click “Add this server” Now click Manual Installation. Now go back to Lighsail server and connect using browser based SSH. This is lot easier than using Putty, if you wish to login via Putty, use the PEM key that we downloaded at the beginning of the video. Do not close the Terminal window until the end of this tutorial.

After logging in to the server, now we have to change the role as root user. To do this, type “sudo -i” You will see the $ symbol changed to # symbol

Now copy the Runcloud installation script and paste the script in the terminal. This process is going to take several minutes before it gets completed. Keep the Terminal window open, at the end it is going to give you FTP username and password, which is need to login via FTP using Filezilla or Cyberduck or any other FTP application.

While this is running, we are going to configure our DNS. Now we need to add a few A records for this server, I recommend to use Cloudflare but if you are using any other DNS provider, that is still fine. Create an A record for yourdomain.com and www.yourdomain.com with the static IP. I recommend switching off the Proxy if you are using Cloudflare, until the installation is completed, as it might cause issues with LetsEncrypt validation.

Now we will go back to Runcloud, click on server. Click the name of your server to view your server details. You will be able to see your server details, server health, issue SSL etc., This is why I recommend Runcloud. Now click, Web Application on the left side, we are going to create a webapp. So, let us create a custom web application. Give the name that you will recognize. Now choose, Use my own domain / subdomain and Enter your domain name. You can also enable www version, if you wish and select redirection options. We will skip DNS integration as we have already done it manually. Ensure use existing system user is selected. Select the PHP version that is compatible with your WHMCS. I am going to choose 7.3 as it works with most 8.x versions. Enable AutoSSL. If the AutoSSL fails for some reasons, do not worry, that only indicates that DNS propagation is not completed yet. You will be able to reissue the SSL later.

Now click “Add Web Application”

After few minutes the web application will get completed with SSL. Now click “back to web apps” click database from the left side menu. Click create database user to add a new database user. Now enter username, password and click Add user. Once this is done, we are going to create a database. To do this, click “Create Database” Give a name to the database. Next Assign the database user that we have just created. Now on Collation, select “utf8_unicode_ci” and then click Add database. Now the app and the database are created. To check if your website is accessible with https, please enter yourdomainname.com/index.html

This will show up a runcloud default HTML, which we will delete in the next step. Now it is time to login to the FTP via Filezilla or equivalent application.

Open Filezilla, enter your server IP in the host name. The username will be runcloud by default and the password will be the one that we copied from the Terminal window and Port number will be 22. If you missed coping the password, you can reset the password under system user, just select Lock Icon under “change password” and click the desired password. Make it complicated to ensure that it is safe.

Now click quick connect, if you are logging in for the first time, you will get this popup warning and you can click OK. Now click “Webapps” folder and then click the app name folder that you choose to install. Delete the Index.html file.

Now go back the WHMCS zip file that we extracted some time ago. If this step is not completed, you have to wait until it finishes. We are going to upload the extracted files to the application folder. Please ensure that you are uploading files in the correct folder as you see here. Rename your local folder name to the one that you have created on webapps. In this example, it is web-whmcs-demo.

Just right click on the local folder that you wish to upload and click “Upload” If you get overwrite warning, allow it to proceed. This has got nearly 30K files, hence it is going to take a long time.

While this is in progress, we will install Ioncube Loader manually, which is a PHP extension.

This step is required only in Nginx Apache configuration and not required with Openlitespeed. Install Ioncube loader only if the browser says Ioncube loader is missing.

To do this, you are going to follow the tutorial in Runcloud itself. I am not covering each and every step in that because the commands are different for every PHP version. As we have installed PHP 7.3, we are going to install Ioncube loader for PHP 7.3. Replicate the same for your version of PHP as given in the article.

To do this simply copy and paste the commands from this page in to the terminal. If you have been timed out, reconnect to browser SSH. Make sure you are still logged as root user. You can type the command “whoami”. If you see ‘Ubuntu’ and not as root user, type “sudo -I” Now type whoami again, if you see root. Then copy and paste these two scripts. Now the Ioncube Loader installation is complete.

If Filizilla is still uploading, take a break and then come back. This is one of the main advantages of having a cPanel, we could have probably done this in 30 seconds.

I assume that Filezilla has completed the upload. Now we are going to install WHMCS. First step is to rename the filename of configuration.php.new to configuration.php and press enter. Then go the address bar and type, yourdomain.com/install and follow the on-screen instructions. Please ensure that the system meets all the necessary requirements. Now configure the database that we have already created, Enter database name and user details. Now the installation is complete but before we get it started, we need to ensure that the install folder is deleted. To do this, go back to Filezilla and only delete the “/install” folder. I repeat, only delete the install folder. Then change the configuration file permissions to 444 and /vendor permission to 770 . And then create a cron job for the automated tasks. To run cron job, enter in to your server, click cron job, give a job label, choose vendor library as /usr/bin/node and copy paste command. There is one more last step to avoid WHMCS error, that is to enable 2 php functions, escapeshellcmd and set_time_limit. To do this in runcloud, click the webapp name and then click settings from the left bar, now scroll down to “disable_functions” and carefully delete these 2 function names. Now you the error would have gone.

That is it for this tutorial, hope you learnt how to use WHMCS with AWS LightSail and Runcloud. In this channel we will be posting beginner to intermediate level videos. If you like this video, please like, share and subscribe to the channel to see more such videos.