sudo fallocate -l 2G /swapfile || sudo dd if=/dev/zero of=/swapfile bs=1M count=2048
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
# optional but recommended
echo 'vm.swappiness=20' | sudo tee /etc/sysctl.d/99-swappiness.conf
sudo sysctl -p /etc/sysctl.d/99-swappiness.conf
free -h
swapon --show
Friday, February 27, 2026
Allocate swap file, when server RAM GB is low to remove mysql errors
Tuesday, February 10, 2026
cPanel multi-domain hosting for laravel project
STEP 1 — Create the Subdomain
cPanel → Domains → Create A New Domain (or Subdomains)
cPanel will automatically create:
/home/egproject/test.example.com/
2️⃣ Now open:
Copy EVERYTHING inside public folder to:
/home/egproject/test.example.com/
So that folder contains:
STEP 4 — Modify index.php (CRITICAL)
Change these lines:
FROM:
require __DIR__.'/../vendor/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
TO:
require __DIR__.'/../test/vendor/autoload.php';
$app = require_once __DIR__.'/../test/bootstrap/app.php';
Because your Laravel core lives in /test.
STEP 5 — Update .env
STEP 6 — Permissions (Very Important)
In File Manager:
Set:
test/storage → 755 test/bootstrap/cache → 755
If errors:
chmod -R 775 storage
chmod -R 775 bootstrap/cacheSTEP 7 — Set up database
Thursday, January 29, 2026
How to allow higher MB file uploads by increasing size in server php.ini
1) Check php version using the command:
php -v
2) Make sure server is using apache php or php cli by using the below command
sudo systemctl status
3) Check if any php-fpm is running. else
sudo nano /etc/php/8.4/cli/php.ini
4) Edit php.ini and change these values from 2M to 10 or 20 M
upload_max_filesize = 10M
post_max_size = 10M
4. Restart web server:
sudo systemctl restart php8.4-fpm
sudo systemctl restart apache2
Monday, January 26, 2026
Get Gmail App Password for email notification through laravel app
First, you need to create an App Password from your Google Account:
Go to your Google Account: https://myaccount.google.com/
Click on "Security" in the left menu
Enable "2-Step Verification" if not already enabled
Go back to Security → 2-Step Verification
Scroll down to "App passwords"
Select "Mail" and "Other (Custom name)"
Enter a name like "Laravel App"
Click "Generate"
Copy the 16-character password (no spaces)
Update .env file with the following info:
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=your-email@gmail.com
MAIL_PASSWORD=your-16-char-app-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="your-email@gmail.com"
MAIL_FROM_NAME="${APP_NAME}"
Friday, January 23, 2026
How to change git origin for repo after making a copy of the repo
1) Locally run the following commands for the existing repo:
git remote -v
This will help us find the current remote origin
2) Set remote origin to the new repo:
git remote set-url origin git@gitlab.com:folder/repo.git
3) Locally ensure that it is in the correct branch
git checkout import-main
4) if activities were done in a new branch, merge it with the current branch "import main"
git merge main
5) push the code to the git
git push
Tuesday, December 30, 2025
Create a basic Sharepoint communication Site for your company
✅ Step-by-step: Build MyCompany SharePoint Internal Hub
Step 0 — Decide Names (use these)
- Hub site: MyCompany Central Hub
- Sites: Operations, IT & Systems, Sales & Marketing, Finance, Compliance & Legal, Events & CME
1️⃣ Create the Main Hub Site (Central Portal)
- Go to: Microsoft 365 → App Launcher (9 dots) → SharePoint
- Click: Create site
- Choose: Communication site
- Select a template: Blank (best) or Topic
- Site name: MyCompany Central Hub
- Click Finish
✅ This becomes your main landing page.
2️⃣ Register it as a Hub Site (Admin Step)
- Open: SharePoint Admin Center
1. Go to https://admin.microsoft.com
2. Select Admin centers → SharePoint
- Go to: Sites → Active sites
- Find and select: MyCompany Central Hub
- Click: Hub → Register as hub site
- Hub name: MyCompany Central Hub
- Save
✅ Now you can manage global navigation + consistent branding.
3️⃣ Create Department Sites (Communication Sites)
Repeat these steps for each department:
- In SharePoint home → Create site
- Choose: Communication site
- Name: MyCompany Operations
- Finish
Create these sites:
- MyCompany Operations
- MyCompany IT & Systems
- MyCompany Sales & Marketing
- MyCompany Finance
- MyCompany Compliance & Legal
- MyCompany Events & CME
4️⃣ Connect Each Site to the Hub (Very important)
For each department site:
- Open the department site
- Click: Settings (⚙️) → Site information
- Look for: Hub site association
- Select: MyCompany Central Hub
- Save
✅ Now all sites share the same top navigation style and theme.
5️⃣ Build the Top Menu (Hub Navigation)
- Open: MyCompany Central Hub
- At top menu, click: Edit
- Add links (one by one):
· Click ➕ Add link
4. ·
- Operations → link to Operations site
- IT & Systems → link to IT site
- Sales & Marketing → link to Sales site
- Finance → link to Finance site
- Compliance & Legal → link to Compliance site
- Events & CME → link to Events site
- Click: Save
✅ This gives you the “AIU-style” department navigation.
6️⃣ Create the Hub Home Page Layout
A) Add the Banner
- On hub home → click Edit
- Click + → add Hero Web Part
- Choose layout: Layered
- Add a banner image (brand/medical theme)
- Title: MyCompany Central Hub
- Subtitle: Internal Operations & Systems Portal
B) Add Quick Action Buttons (right side feel)
- Click + under the banner area
- Add Quick Links
- Layout: Buttons
- Add buttons:
- SOPs & Policies
- IT Support Request
- Finance Requests
- Compliance Docs
- CME & Events
- Publish the page
7️⃣ Create Document Libraries (Core of SharePoint)
Go to each department site and create libraries:
Operations site:
- SOPs & Policies
- Templates
- Reports
IT & Systems site:
- System Documentation
- Deployment Notes
- Change Requests (List, not library)
Finance site:
- Invoices
- Budgets
- Vendor Payments
Compliance site:
- Contracts
- Regulatory Docs
- Audit Records
Events & CME:
- Event Planning
- Post-Event Reports
- Marketing Assets
How to create a library:
- Go to the site → New → Document library
- Name it
- Create
8️⃣ Create Lists for Requests (Forms replacement)
A) IT Support Request List
- Go to IT site
- Click New → List
- Choose Blank list
- Name: IT Support Requests
- Add columns:
- Request Type (Choice)
- Priority (Choice: Low/Med/High/Urgent)
- Requested By (Person)
- Description (Multiple lines)
- Status (Choice: New/In Progress/Done)
B) Operations Requests (Optional)
Same concept for Operations.
9️⃣ Setup Permissions (Internal-only)
Since suppliers cannot access, keep it simple:
- Go to each site → Settings (⚙️) → Site permissions
- Use standard groups:
- Owners (full control)
- Members (edit)
- Visitors (read)
✅ Recommendation:
- Operations: most staff can read
- IT: only IT team can edit
- Finance/Compliance: restricted access
🔟 Turn on Versioning (Very important)
For each document library:
- Open library → Settings → Library settings
- Click Versioning settings
- Enable:
✅ Create major versions
✅ Keep versions (e.g., 50)
This prevents accidental loss.
1️⃣1️⃣ Publish + Test
- Log in as a normal user (or test account)
- Confirm they can:
- Open hub
- Navigate sites
- View correct docs
- Not access Finance/Compliance (if restricted)
Wednesday, December 24, 2025
Set Up PostgreSQL locally in Ubuntu
Install PostgreSQL
sudo apt update
sudo apt install postgresql postgresql-contrib
sudo systemctl start postgresql
Basic Setup
# Create database and user
sudo -u postgres psql
# In PostgreSQL shell:
CREATE DATABASE myapp;
CREATE USER myuser WITH PASSWORD 'mypassword';
GRANT ALL PRIVILEGES ON DATABASE myapp TO myuser;
\q
Connect
# Command line
psql -h localhost -U myuser -d myapp
# Connection string
postgresql://myuser:mypassword@localhost:5432/myapp
Environment Variables
DATABASE_URL="postgresql://myuser:mypassword@localhost:5432/myapp"
Wednesday, October 29, 2025
AWS Data Lifecycle Manager (DLM) setup for automated EC2 backups
Step 1: Choose “Custom policy” (as shown)
Keep:
-
Custom policy → selected
-
Policy type →
EBS snapshot policy
Then click Next step 🟧
Step 2: Target Resource Type
-
Resource type: Select Volume
-
Target resource tags:
Add the tag you used on your EC2 volume, for example:-
Key:
Backup -
Value:
Daily
-
Only the volumes with this tag will be backed up automatically.
Step 3: Configure Schedule
-
Schedule name:
Daily-EC2-Backup(or Weekly if preferred) -
Frequency:
Every 24 hours(for daily) orEvery 7 days(for weekly) -
Start time: Choose off-peak (e.g.,
02:00 UTC) -
Retention type: “Count”
-
Retain:
7snapshots (automatically delete older ones)
Enable these options:
-
☑ Copy tags from source
-
☑ Exclude boot volumes (optional — keep unchecked if you want full backups including OS)
Step 4: IAM Role
If this is your first lifecycle policy:
-
Choose “Create new role for this policy”
AWS will auto-generate permissions for DLM to create/delete snapshots.
Step 5: Review and Create
-
Review your policy summary (target tag, schedule, retention, IAM role)
-
Click Create Policy
Verification
After 24 hours (or at next schedule), go to:
👉 EC2 → Snapshots
You’ll see entries like:
“Created by EC2 Lifecycle Policy: Daily-EC2-Backup”
That confirms your automation works.
Tuesday, October 28, 2025
Push your local project to your own GitHub account
Step 1 — Check current remote
Run this in your project folder:
git remote -v
You’ll probably see something like:
origin https://github.com/username/reponame (fetch)
origin https://github.com/username/reponame (push)
Step 2 — Set the correct remote for
the usernamegit remote set-url origin https://github.com/username/reponame.git Step 3 — Verify the change
Run again:
git remote -v
You should see:
origin https://github.com/username/reponame (fetch)
origin https://github.com/username/reponame (push)Step 4 — Set your identity (you already did this, but just to confirm)
git config user.name "username"
git config user.email "email@gmail.com"Step 5 — Push to GitHub
Now push the main branch:
git push -u origin main
If prompted for credentials:
-
Username:
-
Password: your GitHub Personal Access Token (PAT) (not your GitHub password)
👉 Create one here: https://github.com/settings/tokens
When creating the token:
-
Choose “Fine-grained personal access token”
-
Grant Repository → Read and write access
Copy and paste it when Git asks for your password.
Set up GIT Personal Access Token Steps
Go to GitHub.com → Settings → Developer settings → Personal access tokens → tokens (classic)
Generate new token with repo permissions
Copy the token
paste it as password during git push -u origin main
valid for 30 days
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.confReplace
/phpmyadminwith/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
-
Log in to Meta Business Manager.
-
From the left menu → Business Settings.
🔹 Step 2. Create a System User
-
Under Users → System Users.
-
Click Add.
-
Give it a name (example: XXX
_API_User). -
Choose Role = Admin (so it has full permissions).
-
Save.
🔹 Step 3. Assign Assets to the System User
-
After creating the system user, select it.
-
Click Add Assets.
-
Assign your WhatsApp Business Account (WABA).
-
Give it permissions:
-
whatsapp_business_messaging -
whatsapp_business_management.
-
🔹 Step 4. Generate a Permanent Access Token
-
Still inside the system user, click Generate New Token.
-
Choose your app (the one connected to WhatsApp Cloud API).
-
Select permissions:
-
whatsapp_business_messaging -
whatsapp_business_management.
-
-
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 US!" }
}'
🔹 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
https://www.fortinet.com/support/product-downloads#vpn
download deb forticlient vpn package for linux
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
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.