Sunday, February 16, 2025

Upgrade AWS instance and Ubuntu Commands to check system resources

 Check system resources:

lscpu # Check CPU details
free -h # Check RAM
df -h # Check storage

Step 1: Check Instance Compatibility

  1. Login to AWS Console → Go to EC2 Dashboard.
  2. Select your t2.large instance.
  3. Click on Instance SettingsChange Instance Type.
  4. Check if c6i.4xlarge is available in the same Availability Zone.
    • If not, you may need to create a new instance and migrate your data.

     

    Step 2: Stop the Instance

  5. Go to EC2 Dashboard.
  6. Select the t2.large instance.
  7. Click Instance StateStop Instance.
    • ⚠️ Warning: Stopping the instance will cause temporary downtime.

Step 3: Change Instance Type

  1. Select your stopped t2.large instance.
  2. Click on ActionsInstance SettingsChange Instance Type.
  3. From the dropdown, select c6i.4xlarge.
  4. Click Apply.

Step 4: Start the Upgraded Instance

  1. Select your instance.
  2. Click Instance StateStart Instance.
  3. Verify that your application is working as expected.

  1.  


Wednesday, January 29, 2025

AI - Run an LLM locally on your laptop

 1) Google Ollama
2) Download Ollama and Install
3) Go to model section and choose a model you like
4) I chose deepseek-R1-Distill-Qwen-7B
5) Copy paste the command and run it on your terminal

Monday, January 13, 2025

Certified in Advanced SQL from Stanford Online

 


Steps to Explore and Enroll in Free Stanford Courses:

  1. Visit the Stanford Online Platform:

    • Open
    • https://online.stanford.edu/explore?filter[0]=free_or_paid%3Afree&keywords=Computer&items_per_page=12&page=1
  2. Use Filters to Customize Your Search:

    • On the left side, apply filters like:
      • Cost: Select "Free" to filter out paid courses.
      • Keywords: Use terms like "Computer Science," "Data," or "Technology" for focused results.
  3. Browse Available Courses:

    • Scroll through the results to find courses that interest you, such as topics in SQL, AI, cloud computing, or programming.
  4. Select a Course:

    • Click on a course to view its details, including:
      • Course description
      • Start dates
      • Instructor credentials
      • Time commitment
  5. Check Prerequisites (if any):

    • Ensure the course suits your current knowledge level.
  6. Enroll in the Course:

    • Click the "Enroll Now" or "Sign Up" button. You may need to create a free Stanford Online account or log in with an existing one.
  7. Access Course Materials:

    • Once enrolled, you'll be redirected to the course dashboard. Access videos, readings, and assignments from there.
  8. Complete the Course:

    • Stay consistent with the course schedule. Participate in quizzes or projects as needed.
  9. Earn a Certificate (Optional):

    • For free courses, certificates may not always be provided. If offered, ensure you meet the completion criteria.
  10. Apply the Knowledge:

  • Use your new skills in personal or professional projects. Highlight them on your resume or LinkedIn profile for added impact.


Now I know what it feels like to get hacked!!!!

 
            


Lesson Learned - Ensure you have a STRONG PASSWORD for DB

Wednesday, October 2, 2024

Important Website

https://pexels.com  // to get free stock images

rollout.site //AI site to generate website 


//Server to try out

 contabo.com/en/vps - 12 vcpu cores, 48 GB RAM, 400 GB NVMe, 3 snapshots, 32 TB Traffic

Monday, September 2, 2024

Steps to install the LAMP (Linux, Apache, MySQL/MariaDB, PHP) stack on Ubuntu 22.04 AWS t2 micro instance for LARAVEL 11

PRE-REQUISITES:

1) login to amazon.aws.com, and launch ubuntu 22.04 instance with 30 GB EBS

2) SSH to the AWS Server

To install the LAMP (Linux, Apache, MySQL/MariaDB, PHP) stack on Ubuntu 22.04, follow these steps:

Step 1: Update the System

Before you begin, ensure your package list and installed packages are up-to-date by running the following command:

sudo apt update && sudo apt upgrade -y

Step 2: Install Apache

  1. Install Apache by running the following command:

    sudo apt update

    sudo apt install apache2

    press Y and hit ENTER to continue


    TEST:
    http://your_server_ip


    Verify Apache Installation: After installation, you can check the status of Apache to ensure it's running:

    sudo systemctl status apache2

    Step 3: Install MySQL

    1) Install MySQL Server:

    sudo apt install mysql-server -y
     

    Secure MySQL Installation: Once MySQL is installed, run the security script to secure your installation:


  2. sudo apt install mysql-server

    switch its authentication method from auth_socket to mysql_native_password

            sudo mysql
            SELECT user,authentication_string,plugin,host FROM mysql.user;

            ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
            FLUSH PRIVILEGES;

    TEST
            SELECT user,authentication_string,plugin,host FROM mysql.user;
            exit

    2)sudo mysql_secure_installation

    --VALIDATE PASSWORD PLUGIN.-NO
    REST- YES


    Verify MySQL Installation: Check the MySQL service status:

    sudo systemctl status mysql
     

    Step 4: Install PHP 8.2

  3. To install PHP 8.2 and all the necessary modules for Laravel on Ubuntu 22.04, follow these steps:

    Step 1: Update the System

    First, ensure your package lists are up-to-date:

    Step 2: Add the PHP Repository

    The default Ubuntu repositories might not have the latest PHP versions. To get PHP 8.2, you'll need to add the ondrej/php repository:

  4. Install the software-properties-common package if it’s not already installed:

    sudo apt install software-properties-common -y
    Add the PHP repository:

    sudo add-apt-repository ppa:ondrej/php
    sudo apt update
     sudo apt install php8.2 php8.2-cli php8.2-fpm php8.2-mysql php8.2-pgsql php8.2-sqlite3 php8.2-xml php8.2-mbstring php8.2-curl php8.2-zip php8.2-bcmath php8.2-gd php8.2-intl php8.2-readline php8.2-soap php8.2-imagick -y

  5. Step 4: Install Composer (PHP Dependency Manager)

    1. Download and install Composer:

      curl -sS https://getcomposer.org/installer | php

      2. Move Composer to a directory in your PATH:
       sudo mv composer.phar /usr/local/bin/composer

      3. Verify Composer installation:

      composer --version

      Step 5: Configure Apache or Nginx (Optional)

      If you're using Apache or Nginx, you might need to configure them to use PHP 8.2.

      For Apache:

    2. Install the PHP 8.2 module for Apache:

      sudo apt install libapache2-mod-php8.2 -y
       

    3.  Disable the old PHP module and enable the new one:

      sudo a2dismod php8.1
      sudo a2enmod php8.2
       

      4.Restart Apache2

      sudo systemctl restart apache2 

      -------------------------------------------------------------------------------------------------------------------------

      git clone

      git checkout branch

      sudo composer install --ignore-platform-req=ext-mongodb

      ----------------------------------------------------------------------------------

      update DNS Record in the domain registrar add A record with elastic IP:
    4. --------------------------------------------------------------------

       

Step 1 — Create a conf file

Copy 000-default.com.conf to create a new file in /etc/apache2/sites-available:

$ cd /etc/apache2/sites-available
$ sudo cp 000-default.com.conf example.com.conf


    -include that directory to sites available using <directoryname>.conf file- sudo nano /etc/apache2/sites-available/directoryname.conf

 


<VirtualHost *:80>

ServerName example.com

ServerAlias www.example.com //for www domain

DocumentRoot /var/www/html/example.com/public

<Directory /var/www/html/example.com>

AllowOverride All

</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

 

Step 3 — Enabling a virtual host


-to enable the site
        sudo a2ensite <directoryname>
    -to test for syntax errors
        sudo apachectl configtest
-syntax ok

    -restart apache services
        sudo systemctl restart apache2

Step 4— Enabling SSL

Install certbot

sudo snap install --classic certbot

 

$ sudo certbot --apache -d example.com -d www.example.com 
 
sudo systemctl restart apache2 



 

Create free Business email using ZOHO

 

Zoho Mail offers a free email hosting plan for custom domains with up to 5 users. Here’s how to set it up:

  1. Sign up for a free Zoho Mail account. 
  2. Login as admin https://mailadmin.zoho.com.au/hosting
  3. Add as many users, email accounts
  4. Verify your domain by adding a TXT or CNAME record to your domain’s DNS settings.
  5. Change Password, to create password for them
  6. use https://www.zoho.com/mail/login.html to login to each user email account

 

Tuesday, August 27, 2024

Step-by-step tutorial for beginners to set up a Django project on Ubuntu:

 Step 1: Install Python and Pip

 Update the package list:

sudo apt update 

Install Python 3 and pip:
sudo apt install python3 python3-pip -y

Verify the installation:
 python3 --version
pip3 --version

Step 2: Install Virtual Environment

Install venv (if not installed):

sudo apt install python3-venv -y
 

Create a virtual environment: Navigate to your project directory and create the environment:

mkdir my_django_project
cd my_django_project
python3 -m venv env
 

Activate the virtual environment:

source env/bin/activate
Your terminal prompt should now show (env).

 

Step 3: Install Django

Install Django:

pip install django
 

Verify the installation:

django-admin --version


Step 4: Start a Django Project 

Create a new project:

django-admin startproject mysite

Navigate to the project directory:

 cd mysite
To verify that everything is working, run the Django development server.

python3 manage.py runserver
Step 7: Create a View

Edit myapp/views.py:

from django.shortcuts import render

def home(request):
    return render(request, 'home.html')


Create a URL pattern: Edit mysite/urls.py to include your app’s view: 

from django.contrib import admin
from django.urls import path
from myapp import views

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', views.home),
]

Run the server again:
python3 manage.py runserver

Step 8: Create a Template

mkdir -p myapp/templates
 

Create an HTML file myapp/templates/home.html:

<!DOCTYPE html>
<html>
<head>
    <title>Django App</title>
</head>
<body>
    <h1>Welcome to Django!</h1>
</body>
</html>

Modify the view to render the template: In myapp/views.py:
from django.shortcuts import render

def home(request):
    return render(request, 'home.html')
 

Run the server and refresh the browser. You should now see the HTML content rendered.

 

Friday, August 9, 2024

Steps to install Laravel 11 project

 

Ubuntu 22.04, Apache

  • PHP >= 8.2
  • MySQL or other database server
  • Composer
  • NodeJS
  •  sudo apt-get install php8.2-mysql
     sudo apt-get install php8.2-xml
  •  sudo apt-get install php8.2-mbstring  
  • sudo apt-get install php8.2-curl

How to Install

  1. Clone the project
  2. Go to the project root directory and run composer install and npm install
  3. Create .env file and copy content from .env.example
  4. Run php artisan key:generate from terminal
  5. Change database information in .env
  6. Run migrations by executing php artisan migrate , Then Run php artisan db:seed if you want use faker database records,
  7. Start the project by running php artisan serve
  8. Run in another commandline npm run dev
 REFERENCES:
 
  1. https://github.com/YasserElgammal/blog-cms

php artisan storage:link

Thursday, August 1, 2024

Steps to install Laravel Boiler Plate

1) Git clone https://github.com/rappasoft/laravel-boilerplate.git

2) cd /var/www/html/laravel-boilerplate , set up .env file

3) php artisan key:generate

4) composer install

5) npm install

6) php artisan session:table

7) php artisan migrate

Sunday, July 28, 2024

Command to do Automated unit testing in laravel

 php artisan test

Steps to run auto backup to AWS S3 in laravel docker environment


1- Use spatie/laravel-backup package to implement project folder back-up to the  server

2- Manually run the backup , by running its cronjob

                 php artisan backup:run

3- Check your AWS account to view backups 

4- Download to your device and back-up to hard disk