Wednesday, October 2, 2024

Important Website

https://pexels.com

 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

Setting up budget friendly POS

Prerequisites

1)Purchase necessary Hardware Barcode Printer, Invoice Printer, Scanner

2) laptop/ System needs to have 3 USB ports

3) 3 power cables will be there, so better to have an extension cable

4) POS s/w hosted in Digital Ocean Server, so as to be available anywhere

5) Barcode label role (50 x 25 cm)

6) Invoice printer sheet roll

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

1)Preferred Invoice printer - EPSON-TM-T20III-Series

a) Download the driver, from the link below, choose the correct Windows version 

https://epson.com/Support/Point-of-Sale/Thermal-Printers/Epson-TM-T20III-Series/s/SPT_C31CH51001?review-filter=Windows+10+64-bit

b)During installation don't forget to choose USB Port

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

2)Preferred Barcode printer -Honeywell pc42d (300 dpi)

a) first download and Install download manager from the below link

https://hsmftp.honeywell.com:443/en/Software/Printers/Printer-Software-and-Drivers/Label-Design-Applications/Current/BarTender_UL_2022

b) Then download and install bartender lite software

https://sps-support.honeywell.com/s/article/How-to-download-BarTender-Ultralite-for-Intermec-legacy-printers

c) To print the barcode on label, 

   -- Add product to the POS software, download barcode,

   -- open the barcode designer software, 

           File--> new-->predefined stock (40336)

 select next on other items and print the barcode

-




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

3) Connect with zebra or honeywell scanner

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

Thursday, May 30, 2024

MERGING MULTIPLE SPF RECORDS FOR YOUR GODADDY DOMAIN

 If you have multiple SPF records, delete them to avoid conflicts.Add a single SPF record with the combined directives:

Eg:
1.  v=spf1 include:_spf.elasticemail.com include:spf.protection.outlook.com -all

2. v=spf1 include:_spf.mlsend.com include:_spf.mlsend.com include:_spf.elasticemail.com include:spf.protection.outlook.com -all

Combined
  1. v=spf1 include:_spf.elasticemail.com include:spf.protection.outlook.com include:_spf.mlsend.com -all
  2. Save Changes:

    • Save the changes to your DNS records.

Verify the SPF Record

After updating the SPF record, verify that it has been correctly applied:

  • Use MXToolbox SPF Lookup https://mxtoolbox.com/SuperTool.aspx to check the SPF record for your domain.
  • Ensure that the record includes all necessary includes (_spf.elasticemail.com, spf.protection.outlook.com, _spf.mlsend.com).

Tuesday, May 28, 2024

Adding Meta Tags

 

Steps to Implement

  1. Edit your HTML file: Open your HTML document in your preferred text editor.
  2. Insert meta tags: Add the meta tags within the <head> section as shown in the example above.
  3. Save the changes: After adding the meta tags, save the file.
  4. Upload your file: If your website is hosted, upload the updated HTML file to your web server.

Validation

After adding meta tags, you can validate your HTML to ensure there are no errors. You can use the W3C Markup Validation Service https://validator.w3.org/ to check your HTML.

How to check if code is changed from LUMEN to LARAVEL

 Here are some ways to check your code after your team migrated it from Lumen to Laravel:

Here are some ways to check your code after your team migrated it from Lumen to Laravel:

General checks:

  • Project Structure:
    • Verify the Laravel directory structure. Laravel has a specific directory layout with folders like app, config, resources, etc. Ensure these folders exist and contain the expected files.
  • Configuration:
    • Check the composer.json file to see if Laravel dependencies are installed.
    • Review the config directory. Key Laravel configuration files like app.php, database.php, etc. should be present and configured correctly.
  • Autoloading:
    • Ensure the autoload section in composer.json reflects the Laravel PSR-4 autoloading structure.
  • Routing:
    • Look for the routes directory. Laravel uses routes defined in this directory for handling requests. Ensure routes are migrated properly from Lumen.
  • Controllers:
    • Verify that controllers are located in the app/Http/Controllers directory (default Laravel location) and use Laravel controller features like dependency injection and middleware.

Framework-specific checks:

  • Lumen-specific code: Identify and remove any Lumen-specific code that is no longer relevant in Laravel. This could include custom service providers, facades, or helper functions.
  • Laravel features: Look for usage of new Laravel features like middleware, Eloquent ORM, or service providers that may have replaced Lumen functionality.

Testing:

  • Unit Tests: Run any existing unit tests to ensure core functionalities still work after the migration.
  • Manual Testing: Manually test critical functionalities of your application to identify any regressions introduced during the migration.

Additional resources:

By following these steps and referencing the resources, you can gain a good understanding of the changes made during the migration and identify any potential issues. Remember, the specific checks will depend on the complexity of your application and the extent of the migration.

Thursday, May 9, 2024

Edit PDF

 Edit PDF using https://www.sejda.com/pdf-editor?

Edit PDF META DATA https://pdfcandy.com/