Building your first e-Learning Platform for free
Tags: devops, beginners, cloud, tutorial
Published: 2022-03-12 05:59:12

## DAY 20 - Building your first e-Learning Platform for free - Day Twenty

 
[![Image tweet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jfjzxg64r7q0i8ra6b8t.png)![Image cover](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aesgxbo95cn9pr70r5z2.png)](https://twitter.com/intent/tweet?text=Building%20your%20first%20e-Learning%20Platform%20for%20free%20%2C%20a%20blog%20by%20%40anuvindhs%0A%23moodle%20%23LAMP%20%23cloud%20%23devops%20%23script%20%23automation%0A%0Ahttps%3A%2F%2Fdev.to%2Faws-builders%2Fbuilding-your-first-e-learning-platform-for-free-488o%20)


[100 days of Cloud on GitHub](https://github.com/anuvindhs/100daysofcloud) - [Read On iCTPro.co.nz](https://ictpro.co.nz) - [Read on Dev.to](https://dev.to/anuvindhs)



------


Every content creator is a teacher.

## Why e-learning?

 
E-Learning provides scalability which helps in providing training. All students can receive the same type of syllabus, study materials and train through E-Learning. Through E-Learning, you can save time, money and reduced transportation cost. so, E-Learning is cost-effective compared to traditional learning.


![Image gif](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gvtjmtw12f4yi0325hec.gif)
 
 

## Why Moodle?

The world’s most customisable and trusted open source learning management system.

- It is reliable and secure
- Open Source allows organisations to control their own data
- Flexible and customisable
![Image nutshell](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zhturjzivdvp35k2my8t.png)


## Lets build your first e-Learning site

### Pre-requisite

You can use any public cloud provider or On-Premises to run this code. But  as we mention **FREE** , we will be using **AWS Cloud Free Tier** option.

- Launch a **ubuntu EC2** (**t2.micro if you want to use free version**). This Script is **tested successfully on Ubuntu 20.04**
- Open ports **80(HTTP), 443(HTTPS), 22(SSH)**
- A Database [RDS recommended],Get your DB Credentials. , if you don't know how to create RDS , Follow this [Tutorial](https://aws.amazon.com/getting-started/hands-on/create-mariadb-db/)
- git installed on server

### Setup Infrastucture

- Launch EC2 from AWS console

#### If you are familiar with Terraform here is IAAC for launching this instance

```
terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = "4.5.0"
    }
  }
}

provider "aws" {
 region = "enter-your-desired-region"
}

resource "aws_security_group" "moodlesg" {
  name        = "moodlesg"
  description = "Allow  inbound traffic for Moodle server"


  ingress {
    description      = "HTTPS"
    from_port        = 443
    to_port          = 443
    protocol         = "tcp"
    cidr_blocks      = ["0.0.0.0/0"]
    ipv6_cidr_blocks = ["::/0"]
  }
  ingress {
    description      = "HTTP"
    from_port        = 80
    to_port          = 80
    protocol         = "tcp"
    cidr_blocks      = ["0.0.0.0/0"]
    ipv6_cidr_blocks = ["::/0"]
  }
    ingress {
    description      = "SSH"
    from_port        = 22
    to_port          = 22
    protocol         = "tcp"
    cidr_blocks      = ["0.0.0.0/0"]
    ipv6_cidr_blocks = ["::/0"]
  }
  egress {
    from_port        = 0
    to_port          = 0
    protocol         = "-1"
    cidr_blocks      = ["0.0.0.0/0"]
    ipv6_cidr_blocks = ["::/0"]
  }

  tags = {
    Name = "Moodle-SecurityGroup"
  }
}

resource "aws_instance" "MoodleEc2" {
  depends_on = [
      aws_security_group.moodlesg
      ]
  ami           = "ami-0b7dcd6e6fd797935"
  instance_type = "t2.micro"
  security_groups = [ "moodlesg" ]
  key_name = "your-key-name"
  tags = {
    Name = "Moodle-APP-Server"
  }

}

```
- SSH into server
 - Use putty , here is an awesome [tutorial by Mukesh from dev community](https://dev.to/its_mukeshp/how-to-ssh-a-linux-instance-using-putty-1cjl)


### Basic Installation
- Get sudo privilages
```
sudo su -
```
- Get the code
```
wget https://raw.githubusercontent.com/anuvindhs/GFS-Moo/main/install.sh 
```
- Change permission to install 
```
chmod u+x install.sh 
```
- Install
```
./install.sh
```

- Type **3** and press **enter**
![Image option 3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4o2nd3ttvchexceh056z.png)
 

Now sit back and relax, the script will automatically install **Apache Server, MYSQL DB, PHP and Moodle 3.11** from git.


![Image script](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/js5y7asi0x7tfv5s7mq5.png)
 
 Now if you go to the public ip of your server (which will show once the script complete), you will be able to see the Moodle installed on a lamp server.

![Image moodle](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dpxvmioqh2wo2ksv039g.png)
 
You can either setup Moodle using the RDS or you can setup a **local SQL server** as its a LAMP.

🎉**Congratulations**🎉 on your  e-learning platform , build a better future with a smile.


 ----------

**✅Connect with me on [Twitter](https://twitter.com/intent/follow?ref_src=anuvindhs&screen_name=anuvindhs)
 🤝🏽Connect with me on [Linkedin](https://www.linkedin.com/in/anuvindhs)
🧑🏼‍🤝‍🧑🏻 Read more post on [dev.to](https://dev.to/anuvindhs) or  [iCTPro.co.nz](https://ictpro.co.nz)
💻 Connect with me on [GitHub](https://github.com/anuvindhs)**


{% user anuvindhs %}