How to host Flarum on AWS Lightsail VM Instance - ServerAvatar

Published : Sep 13, 2023

Share This Post

cloud-platform

AWS Lightsail

AWS Lightsail is a simplified and cost-effective way to launch and manage virtual private servers (VPS) in the cloud. It provides a user-friendly interface for deploying and scaling VPS instances with pre-configured options for operating systems, applications, and storage. Additionally, it offers a predictable pricing model that includes a flat monthly fee based on the instance size and data transfer limits.

Get started with AWS Lightsail
application

Flarum

Flarum is a delightfully simple discussion platform for your website. It's fast, free, and easy to use, with all the features you need to run a successful community. It's also extremely extensible, allowing for ultimate customizability.

More info

Create VM Instance in AWS Lightsail

To create a server in AWS Lightsail, First log in to the AWS Lightsail console. Once you are there, Follow the steps given below.

Step 1: Go to Instance Creation Form

To access the instance creation form, Go to AWS Lightsail dashboard and click on the orange button with Create Instance text. See the following image for reference.

Create VM Instance in AWS Lightsail - Step 1

Step 2: Select the Location of your Instance

First of all, You have to select the location for your instance. It is always better to select a location closest to your major traffic source. It will decrease the latency for majority of your website visitors.

Create VM Instance in AWS Lightsail - Step 2

If you want to change the location of your server, You can simply update the current region in your AWS account.

Step 3: Select the OS for your Instance

After selecting the location, Select the operating system for your instance. In this case, First click on OS Only and then select Ubuntu 20.04 as an operating system just like the following image.

Create VM Instance in AWS Lightsail - Step 3

Step 4: Select SSH Key and Launch Script (Optional/Advanced)

This is an optional step. Here you can set the Launch script and the main SSH key for your server. If you don't understand launch script and SSH keys, Just ignore this step.

Create VM Instance in AWS Lightsail - Step 4

Step 5: Select the Plan

In this step, select the size of your VM instance. AWS Lightsail provides lots of different options when it comes to plans and pricing. The plan and pricing selection completely depends on the requirements of your site(s). So, select the plan based on the complexity and traffic of your sites.

Create VM Instance in AWS Lightsail - Step 5

Step 6: Verify and Create the Instance

Finally, Enter the name of your instance, number of instances you want to create and assign the tags accordingly for identification. Once done, click on the Create Instance button to start the instance creation process.

Create VM Instance in AWS Lightsail - Step 6

It might take a few minutes to deploy the instance. Once done, follow the below given step to update the firewall rules for the VM instance.

Step 7: Update Firewall Rules

ServerAvatar requires 43210 port open. In total, You need to keep the following ports open on the instance.

  • 22 (SSH): To access your server via SSH.
  • 80 (HTTP): To access your sites on HTTP.
  • 443 (HTTPS): To access your sites on HTTPS.
  • 43210 (ServerAvatar): To allow communication between ServerAvatar and your instance.

To update the firewall rules for a specific instance, Go to the AWS Lightsail dashboard and click on the name of the instance you want to update. Then go to the Networking section and add the missing firewall rules. After updating the firewall rules, the networking section of your Instance should look like the following image.

Create VM Instance in AWS Lightsail - Step 7

Initial Server Configuration

The Initial server configuration includes installation and configuration of various packages required to host your website. Usually, You have to write commands and modify configuration files. Luckily, With ServerAvatar, Your full server configuration and optimisation can be automated.

Here are the three ways to automatically configure your server with ServerAvatar.

Install and Setup Flarum on Cloud using ServerAvatar

Step1: Create Flarum Database

The Flarum installation process requires database Credentials. So, to create a MySQL database for Flarum, Access the Database tab on the ServerAvatar server panel to create a Database.

image

To create a Database, Enter the details, such as the Database Name, in the database creation form like the image below.

image

Successfully Created a Database.

Steps 2: Create PHP Application

Access the Applications tab from the server panel to create a new PHP application for Flarum.

image

Now fill up the required details in the application form, as seen in the image below.

image

Note that:

If you want to host Flarum on your domain, then make sure to point your domain to the current IP address of your server, and for that:

  1. Log in to your domain provider site, where you buy your domain. Click here for more info about your domain name.
  2. Access DNS Manager to edit your DNS records (contact the support team if you don’t find them)
  3. Change the IP address of A Record of your website to the > current server’s IP address.

To host Flarum on your subdomain, for example, flarum.yourdomain.com, create a new application with the subdomain as your primary domain and follow the same procedure. For accessing Flarum on the subdomain, you need to add your subdomain on A Record that points to the current IP address of your server. To point to an IPV6 address, you would need to use an AAAA record.

Click the Create Next Step.

Now, choose the method and service provider: Git and GitHub (follow as per the snapshot).

image

Continue the process by entering the necessary information as provided below:
Repository Type: Public
Clone HTTPS URL: https://github.com/flarum/flarum.git
Branch: master
Deployment script:

composer install

image

Proceed by clicking the "Next Step".

You can either create a new System User or select an existing one.

image

Next, choose PHP version 7.3 or above. For the custom Webroot should be public shown in the provided snapshot, as we're specifically seeking "index.php" or "index.html" within the custom setup.

Custom Webroot: public

image

Proceed to the next steps and ensure your details and requirements are accurately entered.

After confirming, click on "Create Application" to initiate the application creation process.

Step 3: Install and setup Flarum

Now access the site URL from the Application panel to install and set up Flarum.

We have already created a database for Flarum in step 1. To establish a connection between the database and the application, enter the database credential we have already made. You can access all your database credentials, like database name, username, and password, by accessing the database tab from the server panel.

  1. Enter the following database credential we have already created in ServerAvatar:
    Forum Title: Any Name
    MySQL Host: localhost
    MySQL Database: Database name
    MySQL Username: Username of database
    MySQL Password: Database password
    Table Prefix: change the database table prefix as you want

  2. To create administrator enter the following details:
    Admin Username: any username
    Admin Email: any email
    Password: your password
    Confirm Password: Confirm your Password

image

NOTE: Please remember the credentials you entered above for logging into Flarum. Click Install Flarum.

You will directly logged in to Flarum or Login as admin with admin username and password on the next page to access the admin panel.

image

Successfully install and setup Flarum on the server through the ServerAvatar.