Creating VM in AWS and installing MySQL Server Community Edition

Here we will first look on how to create a VM with the help of AWS(Amazon Web Services) and then we will continue with the installation of the MySQL Server Community Edition

I will provide you with the step by step explanation and the process.



Step 1: Create your AWS account or log in to your AWS account

Step 2: Then click/search on EC2 instances in the console




Step 3: Click on Launch Instances, and fill up the following details:
            
           3.1 Names and tags:
                         Instance name: db01 (you can keep any name)

           3.2 Application and OS Images (Amazon Machine Image):
                        AMI: Amazon Linux 2 (AMI ID ami-0ca9fb66e076a6e32)

           3.3 Instance Type: 
                        t2.micro ( comes under free tier)

           3.4 Key Pair: 
                        If you existing one you can select that, otherwise you can create one 
                        key pair name: any name you want 
                        key pair type: RSA
                        private key file format: .pem
                        Click on create key pair 
            
           3.5 Network settings: 
                        make sure that your Auto-assign public IP is enabled
                        In firewall either create one security group or click on existing security group
                        Important: The security group should have 2 Inbound rules for ports 3306 and 22


           3.6 Configure storage:
                        

           3.7 Summary of all the things we did:



    
                         
     




Step 4: Now go back to instances page, and note down the public IPv4 DNS which in my case is like this:



Step 5: Now go to the terminal and write the following command 
              
        chmod 400 ~/Downloads/dba.pem
 
            (Note: you have to write down the path where your key-pair is located)
            
                ssh -i ~/Downloads/dba.pem ec2-user@<your-public-IPv4-DNS>

            


Great! Your VM should be running successfully now. Let's begin with the installation of MySQL Server Community Edition.               


Firstly make sure your terminal looks somewhat like this:


 




Step 1: Downloading MySQL 8 repository package

        wget https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm

Step 2: Install MySql repo locally
    
        sudo yum localinstall mysql80-community-release-el7-3.noarch.rpm

Step 3: Import public key for MySQL 8
 
        sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023

Step 4: Install MySQL server

        sudo yum install mysql-community-server

Step 5: Enable MySQL server to automatically start on reboot

        sudo systemctl enable mysqld.service

Step 6: Start MySQL server

        sudo systemctl start mysqld.service

Step 7: Check Status of MySQL service
  
        systemctl status mysqld


After running the last command something like this should pop up:















If it is showing like this, then you have successfully installed the MySQL server community edition 🎉


            










Comments