Saturday, September 6, 2025

Steps to setup phpmyAdmin after LAMPP stack setup using ubuntu

 You’re using Ubuntu with a LAMPP stack (Linux + Apache + MySQL + PHP). Let’s walk through installing and securing phpMyAdmin step by step:


🔹 1. Update system

sudo apt update && sudo apt upgrade -y

🔹 2. Install phpMyAdmin

sudo apt install phpmyadmin -y

👉 During installation, it will ask:

  • Web server to configure automatically → choose apache2

  • Configure database for phpMyAdmin → select Yes

  • Set a phpMyAdmin application password (this is for phpMyAdmin’s own database user, not MySQL root).


🔹 3. Enable Apache configuration

If it didn’t auto-enable, manually link phpMyAdmin to Apache:

sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin.conf
sudo systemctl reload apache2

🔹 4. Enable required PHP extensions (LAMPP often needs this)

Make sure these are enabled:

sudo apt install php-mbstring php-zip php-gd php-json php-curl -y
sudo phpenmod mbstring
sudo systemctl restart apache2

🔹 5. Access phpMyAdmin

Now open in your browser:

http://your-server-ip/phpmyadmin

Example:

http://34.199.91.21/phpmyadmin

Login using your MySQL root (or another MySQL user you created).


🔹 6. (Optional) Enable root login if blocked

By default, MySQL root may be set to auth_socket instead of a password. Fix:

sudo mysql -u root

Inside MySQL shell:

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

Now login in phpMyAdmin with root / your_strong_password.


🔹 7. Secure phpMyAdmin

Since phpMyAdmin is a common attack target:

  • Change the URL alias (instead of /phpmyadmin/dbadmin123):

    sudo nano /etc/apache2/conf-available/phpmyadmin.conf
    

    Replace /phpmyadmin with /dbadmin123, then:

    sudo systemctl reload apache2
    
  • Restrict access by IP (allow only your IP).


✅ Done! You now have phpMyAdmin running on your LAMPP server.



Set up a permanent system user access token for WhatsApp Cloud API

To set up a permanent system user access token for WhatsApp Cloud API in Meta Business Manager, here’s the step-by-step process:


🔹 Step 1. Go to Business Settings


🔹 Step 2. Create a System User

  1. Under Users → System Users.

  2. Click Add.

  3. Give it a name (example: MedicalSupplierz_API_User).

  4. Choose Role = Admin (so it has full permissions).

  5. Save.


🔹 Step 3. Assign Assets to the System User

  1. After creating the system user, select it.

  2. Click Add Assets.

  3. Assign your WhatsApp Business Account (WABA).

  4. Give it permissions:

    • whatsapp_business_messaging

    • whatsapp_business_management.


🔹 Step 4. Generate a Permanent Access Token

  1. Still inside the system user, click Generate New Token.

  2. Choose your app (the one connected to WhatsApp Cloud API).

  3. Select permissions:

    • whatsapp_business_messaging

    • whatsapp_business_management.

  4. Generate token → it will look like:

    EAAG...long-string...ZDZD
    

⚠️ Copy it immediately — Meta only shows it once.


🔹 Step 5. Use the Token in Your Code

In your .env file:

WHATSAPP_ACCESS_TOKEN=EAAG...long-string...ZDZD

Use it in your API calls:

curl -i -X POST \
  https://graph.facebook.com/v20.0/{{PHONE_NUMBER_ID}}/messages \
  -H "Authorization: Bearer $WHATSAPP_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
        "messaging_product": "whatsapp",
        "to": "965XXXXXXXX",
        "text": { "body": "Hello from MedicalSupplierz!" }
      }'

🔹 Step 6. Token Lifetime & Refresh

  • System user tokens are long-lived (permanent), but they can be invalidated if:

    • You remove the system user.

    • You change business security settings.

  • Best practice: Store the token securely and rotate it periodically.


✅ After this, you’ll have a permanent token that won’t expire every 24 hours, unlike the test tokens.



 

Friday, August 1, 2025

Steps to Connect to VPN and RDP from ubuntu device to windows



Step 1) Setup Forticlient

wget -O - https://repo.fortinet.com/repo/forticlient/7.4/ubuntu22/DEB-GPG-KEY | gpg --dearmor | sudo tee /usr/share/keyrings/fortinet.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/fortinet.gpg] https://repo.fortinet.com/repo/forticlient/7.4/ubuntu22/ stable non-free" | sudo tee /etc/apt/sources.list.d/fortinet.list
sudo apt update
sudo apt install forticlient
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Step 2) From the Applications, click open "Forticlient"

"Edit VPN Connection" dialog box opens up

VPN : SSL-VPN, fill up the details Connection Name, Description, Remote Gateway, port No: and Save
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Step 3)  1. Install RDP Client on Ubuntu
Recommended tool: Remmina (GUI RDP client)
sudo apt update
sudo apt install remmina -y

2.Open terminal and run remmina

In Remmina:

    Click + to create a new connection.

    Set:

        Protocol: RDP - Remote Desktop Protocol

        Server: IP address or hostname of the remote Windows machine

        Username: Your Windows user

        Password: Your Windows password

    Click Connect.



Monday, July 21, 2025

Create .pem file from .ppk using puttygen software in windows for SSH access from cmd

 

Convert .ppk to unencrypted .pem

If .pem is encrypted and .ppk works, you can convert .ppk to a new .pem: 

  1. Open PuTTYgen 

  1. Click Load → Load your .ppk file 

  1. Go to ConversionsExport OpenSSH key 

  1. Save as something like oxfordAIU_unencrypted.pem 

  1. Try SSH again: 

  2.  

    ssh -i path\to\pem user@ip_address

     

Friday, June 20, 2025

 

1. Register an App in Azure AD

  • Go to: https://portal.azure.com

  • Navigate to: Azure Active Directory > App registrations > New registration

  • if you don't find it goto "Microsoft Entra ID"

  • Once inside, select App Registrations --> New Registration

  • Give it a name (e.g. Laravel Email App)

  • Redirect URI: Can be http://localhost or your app callback

2. Add API Permissions - from right side manage-->choose api permissions

  • Under "API permissions" > search "mail" and Add:

    • Mail.Send (delegated)

    • User.Read

3. Create a Client Secret -From the app registration overview page

  • Under "Certificates & secrets" > "New client secret"

  • Copy the secret value

  • client id and tenant id

Steps to Generate App Password for example@domain.com to use in laravel app, if there is MFA

 

🛠️ Sign in at: https://mysignins.microsoft.com/security-info

  1. Use example@domain.com to log in

  2. Go to Security Info > Click Add method

  3. Select App password

  4. Name it (e.g., “Laravel SMTP”) and click Next

  5. Copy the generated password – you will not be able to see it again

  6. Update your Laravel .env:


Sunday, June 8, 2025

  Step-by-Step: Install Ubuntu Using WSL on Windows

Step 1: Enable WSL and Virtual Machine Platform

Open PowerShell as Administrator and run:

wsl --install

This will install WSL 2, the latest version with full Linux kernel support.

🔸 If WSL is already installed, make sure it's version 2:

wsl --set-default-version 2

Step 2: Install Ubuntu from Microsoft Store

  1. Open Microsoft Store.

  2. Search for "Ubuntu".

  3. Choose your version (e.g., Ubuntu 22.04 LTS).

  4. Click Install.


🔹 Step 3: Set Up Ubuntu

After install:

  1. Launch “Ubuntu” from Start menu.

  2. Wait for it to extract and initialize.

  3. Create a new UNIX username and password.


  4. Step 4: Install Development Tools in Ubuntu (optional)

  5. Inside the Ubuntu terminal:

  6. sudo apt update && sudo apt upgrade -y

    sudo apt install php mysql-server composer nodejs npm git curl unzip -y

  7. composer global require laravel/installer

You need to install the “Remote - WSL” extension inside Visual Studio Code, not from the terminal.

🔹 Step-by-Step to Fix:

  1. Open VS Code

  2. Go to the Extensions view:

    • Shortcut: Ctrl + Shift + X

    • Remote - WSL

    • After Installing:

      To open a WSL Ubuntu project:

      • Press F1 or Ctrl + Shift + P

      • Type:

      • WSL: Open Folder

      🔹 2. Generate SSH Key Pair

    • ssh-keygen -t ed25519 -C "your_email@example.com"

Tuesday, June 3, 2025

Git Setup on Windows

 

1. Install Git for Windows

  • Download and install from: https://git-scm.com/

  • During setup:

    • Choose “Git from the command line and also from 3rd-party software”

    • Choose recommended defaults unless you have special needs

✅ After install, open Git Bash or CMD and run:

git --version

2. Clone Your Laravel + Vue Project

cd C:\xampp\htdocs git clone https://github.com/your-username/your-laravel-vue-project.git cd your-laravel-vue-project

Or initialize a new repo:

git init

3. Set Git User Info (if not set globally)

git config user.name "Your Name"
git config user.email "you@example.com"

4. Typical Git Workflow (Basic Commands)

ActionCommand
Stage changes        git add .
Commit changesgit commit -m "Your message"
Push to remotegit push origin main
Pull latestgit pull origin main
Check statusgit status
Switch branchgit checkout branch-name

5. Optional Git GUI Tools for Windows

If you prefer visual tools:


✅ Laravel + Git Example Setup

In C:\xampp\htdocs\your-project:


composer install npm install cp .env.example .env php artisan key:generate git init git remote add origin https://github.com/your-username/your-repo.git git add . git commit -m "Initial commit" git push -u origin main

Saturday, May 17, 2025

Install and setup docker for local projects

 Install Docker from Official Docker Repo

✅ STEP-BY-STEP TO INSTALL DOCKER & DOCKER COMPOSE (V2)

# 1. Remove any old Docker versions
sudo apt remove docker docker.io containerd runc



# 2. Set up Docker's official GPG key


sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg



# 3. Add the Docker APT repository (for Ubuntu 22.04 "jammy")
 

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
  https://download.docker.com/linux/ubuntu jammy stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null



# 4. Update APT
 

sudo apt update

# 5. Install Docker Engine and CLI (this includes docker-compose v2)
 

sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-c

ompose-plugin -y
 

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

6. Verify Docker is installed

docker --version

7. Verify Docker Compose V2 is working
docker compose version
 

8. Start Docker service (if not running)

sudo systemctl start docker
sudo systemctl enable docker
 

9. Test Docker Compose by running a sample container

mkdir ~/docker-test && cd ~/docker-test
echo -e "services:\n  hello:\n    image: hello-world" > docker-compose.yml
docker compose up
 

🚀 Next Steps: Run Laravel Project in Docker

✅ 1. Directory Structure (example)

/var/www/html/example.com/
├── docker-compose.yml
├── Dockerfile
├── .env
├── app/
├── public/
├── vendor/
├── ...
 

✅ 2. Basic docker-compose.yml Example

version: '3.8'

services:
  app:
    build:
      context: .
    container_name: laravel_app
    ports:
      - "8000:8000"
    volumes:
      - .:/var/www/html
    working_dir: /var/www/html
    command: php artisan serve --host=0.0.0.0 --port=8000
    depends_on:
      - db

  db:
    image: mysql:5.7
    container_name: mysql_db
    ports:
      - "3306:3306"
    environment:
      MYSQL_DATABASE: laravel
      MYSQL_USER: laravel
      MYSQL_PASSWORD: secret
      MYSQL_ROOT_PASSWORD: root
    volumes:
      - dbdata:/var/lib/mysql

volumes:
  dbdata:


✅ 3. Basic Dockerfile

 

FROM php:8.1-cli

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git unzip curl libzip-dev zip && \
    docker-php-ext-install zip pdo pdo_mysql

# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Set working directory
WORKDIR /var/www/html
 

✅ 4. Run the Laravel App 

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

docker compose up --build
--------------------------------------------

 

Wednesday, April 30, 2025

How to get your open AI API Key

 

✅ Step-by-Step Guide to Get Your API Key

  1. Go to the OpenAI Platform
    🔗 https://platform.openai.com

  2. Sign in / Sign up

    • Log in with your existing account, or

    • Create a new account using your email, Google, or Microsoft account.

  3. Go to API Keys

  4. Generate a New API Key

    • Click the "+ Create new secret key" button.

    • Give it a name (optional, for your reference).

    • Copy and store the key safely — you will only see it once.

       

      5. Authenticate: Navigate to your project root in the terminal Export your OpenAI API key:

    Bash
    export OPENAI_API_KEY="YOUR_OPENAI_API_KEY"
    
    (You can get your API key from the OpenAI platform.)
    • Run: Navigate to your project root in the terminal and type codex followed by your request in natural language. For example:
      Bash
      codex "Explain this repo to me."
      
    •  

Sunday, April 20, 2025

Codex CLI - Your coding agent from open AI

 

The OpenAI Codex CLI is a command-line tool that brings the power of OpenAI's language models directly to your terminal, acting as a lightweight coding agent. Here's a breakdown of what it is and what you can do with it:

Key Functionality:

  • Natural Language to Code: You can describe what you want to build, fix, or understand in plain English, and Codex CLI will translate that into code.
  • Code Editing and Generation: It can read, modify, and even run code on your local machine.
  • Multimodal Inputs: Beyond text, it can understand screenshots and diagrams to help generate or edit code accordingly.
  • Integration with Your Workflow: It runs entirely in your terminal, allowing for quick iteration without switching contexts.
  • Configurable Automation: It offers three approval modes to control how hands-on you want to be:
    • Suggest (default): Proposes edits and shell commands, requiring your approval before execution.
    • Auto Edit: Automatically applies file edits but asks for approval before running shell commands.
    • Full Auto: Autonomously reads, writes, and executes commands within a sandboxed, network-disabled environment.
  • Version Control Awareness: It warns you before entering "Auto Edit" or "Full Auto" if your directory isn't under version control.

What You Can Do With It:

  • Build Features Faster: Describe the functionality you need, and let Codex CLI generate the code.
  • Squash Bugs: Ask it to identify and fix errors in your code.
  • Understand Unfamiliar Code: Have it explain the logic and structure of existing codebases.
  • Refactor and Clean Up Code: Instruct it to improve the quality and readability of your code.
  • Write Tests: Ask it to generate unit tests for your code.
  • Set Up Migrations, Batch Rename Files, and Update Imports: Automate common development tasks.
  • Use Repository Markdown for Context: It can understand and utilize information in your project's markdown files.

Getting Started:

  1. Install: Open your terminal and run:
    Bash
    npm install -g @openai/codex
    
  2. Authenticate: Export your OpenAI API key:
    Bash
    export OPENAI_API_KEY="YOUR_OPENAI_API_KEY"
    
    (You can get your API key from the OpenAI platform.)
  3. Run: Navigate to your project root in the terminal and type codex followed by your request in natural language. For example:
    Bash
    codex "Explain this repo to me."
    
  4. Switch Modes (Optional): Use flags like --auto-edit or --full-auto to change the automation level.

Important Considerations:

  • Experimental: Codex CLI is currently an experimental project and may have bugs or undergo changes.
  • Local Operation: Your source code never leaves your local environment unless you explicitly choose to share it.
  • Open Source: The project is open source, and you can find the repository on GitHub (https://github.com/openai/codex).
  • API Key Required: You need an active OpenAI API key to use the CLI.
  • Model Usage: By default, it uses the o4-mini model for speed, but you can specify other available models using the -m flag (e.g., codex -m o3).

In essence, the OpenAI Codex CLI aims to streamline your development workflow by bringing AI-powered coding assistance directly to your terminal, allowing you to interact with your codebase in a more intuitive and efficient way.

Thursday, March 6, 2025

Steps to set up docker in your localhost

 Reference - 

https://docs.docker.com/engine/install/ubuntu/

 

-

1) git clone the code repository that is dockerised

2) cd to git repo 

3) Set up Docker's apt repository

4) 

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
 
5) # Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
 
6) Install the Docker packages
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
7) Verify that the installation is successful by running the hello-world image:
         sudo docker run hello-world
Go to that git folder and run 
8) sudo docker compose -f docker-compose.yml up -d --build 
 
 
--------------------------------------------------------
fix this Error --- An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://dl.google.com/linux/chrome/deb stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 32EE5355A6BC6E42 
---------------------------------------------------------------
1)open your terminal
2) wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
3) If the first method does not work, try this method.
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 32EE5355A6BC6E42