Tuesday, December 20, 2022

Remove Autodesk software from Mac


Uninstall products using the Remove utility

For some products, you can run the Remove ProductName utility in the Finder > Go > Applications > Autodesk folder. The Remove utility uninstalls both the application file and residual files.

  1. Locate the Remove <product name> utility in Finder > Go > Applications > Autodesk.
  2. Double-click Remove <product name> to uninstall a product, where product name is, for example, AutoCAD or AutoCAD LT.

If the Remove utility isn’t available for your software, follow the steps in the next section.

Uninstall products manually

  1. Uninstall all Autodesk programs by right-clicking the program icon and choosing Move To Trash.
  2. Open a Finder window and navigate to the root of the local hard drive and delete the following folders:
    • /Library/Autodesk
    • /Library/Application Support/Autodesk
    • /Users/[username]/Adlm
    • /Users/[username]/Library/Application Support/Autodesk 
      Note: The Library folder is usually hidden. To show it, click the Go menu in the Finder and hold down the Option key.
    • /Users/username/.flexlmrc
    • /Library/Frameworks/Adlm.framework/
    • /Applications/Autodesk/Adlm
  3. Navigate to the folder /Library/Preferences/Flexnet Publisher/FLEXnet and delete the files with the adskflex prefix.
  4. Find and delete the folder /Library/Application Support/Flexnet Publisher
  5. Important:  Don’t delete this folder if you’re running Adobe products on your Mac. Adobe products also use FlexNet. Deleting this folder can cause problems if the Adobe products are still installed. 

Wednesday, December 14, 2022

Composer dependencies issues

 Error 1: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.4.0"

Solution: composer install --ignore-platform-reqs

Remove autodesk Completely


  • ~/Library/Application Support/
  • ~/Library/Containers/
  • ~/Library/Caches/
  • ~/Library/Preferences/
  • ~/Library/Cookies/
  • ~/Library/Logs/
  • ~/Library/LaunchAgents/

Install homebrew mac m1 monterey to run xforce keygen

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

brew --version 
brew install upx 
upx --version 
sudo upx -d {drag keygen from desktop to terminal}

Run these three commands in your terminal to add Homebrew to your PATH:

    echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /Users/architectfaishalbhuiya/.zprofile

    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/architectfaishalbhuiya/.zprofile

    eval "$(/opt/homebrew/bin/brew shellenv)"


MacPro M1 Monterey Xforce Keygen not opening


Copy xf-adesk19 to your Desktop

Open terminal  (Command+Space and type Terminal and press enter/return key)

Paste the following code in terminal:

Code Block 

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null

Wait for the command to finish. After completion run the following code:

Code Block 

brew install upx

Now run this command:

Code Block 

sudo upx -d ~/Desktop/xf-adesk19.app/Contents/MacOS/x-force

Close the terminal and open the xf-adesk19 on your Desktop.


Install rosetta 2 on Mac M1 2021 Pro

softwareupdate -install-rosetta -agree-to-license

softwareupdate --install-rosetta

Monday, December 5, 2022

Update columns values with column of another table based on condition in SQL command

UPDATE table1 SET price=(SELECT price FROM table2 WHERE table1.id=table2.id);

UPDATE table1 SET table1.price=(SELECT table2.price FROM table2 WHERE table2.id=table1.id AND table2.item=table1.item);

UPDATE event INNER JOIN cualumni ON event.user_id = cualumni.eid SET event.user_id = cualumni.id;


UPDATE table1 INNER JOIN table2 ON table1.id = table2.id SET table1.Price = table2.price

Sunday, December 4, 2022

Convert a putty .ppk key to an Amazon .pem file on Mac

$ brew install putty

$ puttygen key.ppk -O private-openssh -o key.pem


$ openssl x509 -in certificatename.cer -outform PEM -out certificatename.pem

Migrate Linux server to AWS EC2

Visit: AWS Replication Agent installation 

wget -O ./aws-replication-installer-init.py https://aws-application-migration-service-us-west-2.s3.us-west-2.amazonaws.com/latest/linux/aws-replication-installer-init.py

sudo python3 aws-replication-installer-init.py --region us-west-2

Saturday, December 3, 2022

Reinstall MySQL in virtualmin

sudo apt purge mysql-server mysql-client mysql-common
sudo apt autoremove
sudo mv -iv /var/lib/mysql /var/tmp/mysql-backup
sudo rm -rf /var/lib/mysql*

Then goto webmin dashboard>Server>MySQL Database Server>Install

PHP Laravel Artisan commands

 php artisan config:clear

 php artisan config:cache

 php artisan route:clear

 php artisan view:clear

 php artisan view:cache

 php artisan event:clear

 php artisan event:cache

 php artisan cache:clear

 php artisan optimize:clear

Saturday, November 26, 2022

How to change the default filename when using mPDF

$payStub=new mPDF();

$payStub->SetTitle('My title');
$payStub->Output('yourFileName.pdf', 'I');

  1. 'D': download the PDF file
  2. 'I': serves in-line to the browser
  3. 'S': returns the PDF document as a string
  4. 'F': save as file $file_out

Thursday, November 24, 2022

Auto deployment from github to server using FTP

 Step-1: Login the github the go to the project and click on setteings and add FTP Password under Security->Secrets. Then click New repository secret and name

Step - 2:Click Actions menu of repository and create the yml file as follows:

Click on Create a new worklow> set up a workflow yourself


Step - 3: Then add the following code to yml file and save.

on: push
name: 🚀 Deploy website on push
name: 🎉 Deploy
runs-on: ubuntu-latest
- name: 🚚 Get latest code
uses: actions/checkout@v2

- name: 📂 Sync files
uses: SamKirkland/FTP-Deploy-Action@4.3.2
server: ourdomain.com/IP
username: username@yourdomain.com //or IP
password: ${{ secrets.FTP_PASSWORD }}
# server-dir: /home/dfaserghx/public_html/

How to delete all commit history in GitHub & repush to main?

Create a new Branch:

git checkout --orphan latest_branch

Add your all the files:

git add .

Save the changes with commit:

git commit -m "commit message"

Delete Main Branch:

git branch -D main

Rename latest_branch to main:

git branch -m main

Force update the repo:

git push -f origin main

Saturday, November 19, 2022

Find duplicates in value using SQL command











    COUNT(*) > 1


SELECT name, COUNT(*) c FROM table GROUP BY name HAVING c > 1;

Wednesday, November 2, 2022

Find All Rows Containing Duplicates using SQL CMD




    users a












        COUNT(*) > 1

) b


    a.username = b.username AND a.email = b.email



Wednesday, October 26, 2022

How to Upgrade and Downgrade the PHP Versions on CentOS 7.9

 php -v

rpm -qa | grep php

yum remove "php-*" -y

yum --disablerepo=remi-php72 --enablerepo=remi-php73 install php php-gd php-mbstring php-mysql php-curl php-mcrypt

rpm -qa | grep php

yum remove "php-*" -y

yum --disablerepo=remi-php73 --enablerepo=remi-php56 install php php-gd php-mbstring php-mysql php-curl php-mcrypt

php -v

Tuesday, October 25, 2022

Set Force HTTPS Using .htaccess file

 RewriteEngine On

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Nginx server block configuration for MailWizz

 server {

  #    if ($host = www.yourdomain.com) {

  #     return 301 https://$host$request_uri;

  #  } # managed by Certbot

    root /var/www/yourdomain.com/public/;

    server_name yourdomain.com www.yourdomain.com;

  # Add index.php to setup Nginx, PHP & PHP-FPM config

  # index index.php index.html index.htm index.nginx-debian.html;

    listen [::]:443 ssl ipv6only=on; # managed by Certbot

    listen 443 ssl; # managed by Certbot

    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem; # managed by Certbot

    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem; # managed by Certbot

#   ssl_certificate /etc/letsencrypt/live/www.yourdomain.com/fullchain.pem; # managed by Certbot

#    ssl_certificate_key /etc/letsencrypt/live/www.yourdomain.com/privkey.pem; # managed by Certbot

    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot

    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

  location / {

    #try_files $uri $uri/ =404;

         if (!-e $request_filename){

             rewrite ^(/)?api/.*$ /api/index.php;


         if (!-e $request_filename){

             rewrite ^(/)?customer/.*$ /customer/index.php;


         if (!-e $request_filename){

             rewrite ^(/)?backend/.*$ /backend/index.php;


         if (!-e $request_filename){

             rewrite ^(.*)$ /index.php;


         index  index.html index.htm index.php;


  # pass PHP scripts on Nginx to FastCGI (PHP-FPM) server

  location ~ \.php$ {

    include snippets/fastcgi-php.conf;

    include /etc/nginx/fastcgi_params;

    # fastcgi_pass;

    # fastcgi_index index.php;

    #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    #fastcgi_read_timeout 600s;

    #fastcgi_send_timeout 600s;

    # Nginx php-fpm sock config:

    fastcgi_pass unix:/run/php/php8.1-fpm.sock; #For PHP-FPM

    # Nginx php-cgi config :

    # Nginx PHP fastcgi_pass;


  # deny access to Apache .htaccess on Nginx with PHP, 

  # if Apache and Nginx document roots concur

  location ~ /\.ht {

    deny all;



Monday, October 24, 2022

Nginx server basic configuration for MailWizz


# For more information on configuration, see:

#   * Official English Documentation: http://nginx.org/en/docs/

#   * Official Russian Documentation: http://nginx.org/ru/docs/

user  nginx;

worker_processes  1;

error_log  /var/log/nginx/error.log;

#error_log  /var/log/nginx/error.log  notice;

#error_log  /var/log/nginx/error.log  info;

pid        /run/nginx.pid;

events {

    worker_connections  1024;


http {

    include       /etc/nginx/mime.types;

    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

                      '$status $body_bytes_sent "$http_referer" '

                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;

    #tcp_nopush     on;

    #keepalive_timeout  0;

    keepalive_timeout  65;

    #gzip  on;

    # Load modular configuration files from the /etc/nginx/conf.d directory.

    # See http://nginx.org/en/docs/ngx_core_module.html#include

    # for more information.

    include /etc/nginx/conf.d/*.conf;

    index   index.html index.htm;

    #root /usr/share/nginx/html;

  # this is the section that matters for mailwizz.

    server {

     listen      80;

     server_name domain.com;

     root        /usr/share/nginx/html;

     location / {

         if (!-e $request_filename){

             rewrite ^(/)?api/.*$ /api/index.php;


         if (!-e $request_filename){

             rewrite ^(/)?customer/.*$ /customer/index.php;


         if (!-e $request_filename){

             rewrite ^(/)?backend/.*$ /backend/index.php;


         if (!-e $request_filename){

             rewrite ^(.*)$ /index.php;


         index  index.html index.htm index.php;


     #error_page  404              /404.html;

     # redirect server error pages to the static page /50x.html


     error_page   500 502 503 504  /50x.html;

     # pass the PHP scripts to FastCGI server listening on


     location ~ \.php$ {

        include /etc/nginx/fastcgi_params;


        fastcgi_index index.php;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        fastcgi_read_timeout 600s;

        fastcgi_send_timeout 600s;


     # deny access to .htaccess files, if Apache's document root

     # concurs with nginx's one


     location ~ /\.ht {

         deny  all;




Sunday, October 23, 2022

How to move all files and folders via mv command

To move all files & folders from one destination to another:  

mv /path/sourcefolder/* /path/destinationfolder/

To move All files & Folder of current:

 mv * /path/destinationfolder/

To move single File:

 mv filename.zip /path/destinationfolder/

Friday, October 21, 2022

How to upload local file to Linux server through Mac SSH terminal

scp /path/to/file username@servername/ip:/destination/folder/

scp /Volumes/HDD/yourfilename.zip root@ip/server:/var/www/yourdirectorypath/public

To copy a file from the local server to the remote one:

scp FILENAME user@remote_server:/remote/path/FILENAME

To copy a file from the remote server to the local one:

scp user@remote_server:/remote/path/FILENAME /local/path/FILENAME

Installing PHP 8.1 to Add PHP support to Nginx on Ubuntu

 Install PHP for Nginx with PHP-FPM:

sudo apt update

sudo apt install --no-install-recommends php8.1 [Apache HTTP server and its httpd process]

sudo apt-get install php8.1-fpm -y [For PHP-FPM works with nginx]

php -v

sudo apt-get install -y php8.1-cli php8.1-common php8.1-mysql php8.1-zip php8.1-gd php8.1-mbstring php8.1-curl php8.1-xml php8.1-bcmath php8.1-imap

php -m

Check if PHP-FPM is running:

sudo systemctl status php8.1-fpm

Add PHP support to Nginx:

sudo nano /etc/nginx/sites-available/default

Enable PHP in Nginx’s config file:

server {

  # Example PHP Nginx FPM config file

  listen 80 default_server;

  listen [::]:80 default_server;

  root /var/www/html;

  # Add index.php to setup Nginx, PHP & PHP-FPM config

  index index.php index.html index.htm index.nginx-debian.html;

  server_name _;

  location / {

    try_files $uri $uri/ =404;


  # pass PHP scripts on Nginx to FastCGI (PHP-FPM) server

  location ~ \.php$ {

    include snippets/fastcgi-php.conf;

    # Nginx php-fpm sock config:

    fastcgi_pass unix:/run/php/php8.1-fpm.sock;

    # Nginx php-cgi config :

    # Nginx PHP fastcgi_pass;


  # deny access to Apache .htaccess on Nginx with PHP, 

  # if Apache and Nginx document roots concur

  location ~ /\.ht {

    deny all;


} # End of PHP FPM Nginx config example

sudo nginx -t

sudo systemctl restart nginx

How to install MySQL on Ubuntu 22.04

 Installing MySQL:

sudo apt update

sudo apt install mysql-server

sudo systemctl start mysql.service

Configuring MySQL:

sudo mysql_secure_installation

Creating a Dedicated MySQL User and Granting Privileges:

  sudo mysql

 mysql -u root -p

 CREATE USER 'mailapp'@'localhost' IDENTIFIED WITH authentication_plugin BY 'password';

 CREATE USER 'mailapp'@'localhost' IDENTIFIED BY 'password';

 CREATE USER 'mailapp'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

 ALTER USER 'mailapp'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';






 mysql -u mailapp -p

How To Make secured Nginx with Let's Encrypt on Ubuntu

 Installing Certbot:

sudo apt install certbot python3-certbot-nginx

Confirming Nginx’s Configuration:

sudo nano /etc/nginx/sites-available/example.com

sudo nginx -t

sudo systemctl reload 

Allowing HTTPS Through the Firewall:

sudo ufw status

sudo ufw allow 'Nginx Full'

sudo ufw delete allow 'Nginx HTTP'

sudo ufw status

Obtaining an SSL Certificate:

sudo certbot --nginx -d example.com -d www.example.com

 Verifying Certbot Auto-Renewal:

 sudo systemctl status certbot.timer

 sudo certbot renew --dry-run

Monday, September 26, 2022

How to change Folder and File Permission in Linux

sudo find /var/www/html -type d -exec chmod 755 {} \;

sudo find /var/www/html -type f -exec chmod 644 {} \;

sudo chmod 644 /var/www/html/textbook.php

sudo chmod 644 /var/www/html/textbook.php

sudo systemctl restart httpd

Wednesday, September 21, 2022

Debian/Ubuntu Linux Specific Commands to Start/Stop/Restart Apache Engine

Debian Linux version 7.x or Ubuntu Linux version Ubuntu 14.10 or older:
/etc/init.d/apache2 restart

sudo /etc/init.d/apache2 restart

sudo service apache2 restart

/etc/init.d/apache2 stop

sudo /etc/init.d/apache2 stop

sudo service apache2 stop

/etc/init.d/apache2 start

sudo /etc/init.d/apache2 start

sudo service apache2 start

Debian Linux version 8.x+ or Ubuntu Linux version Ubuntu 15.04+ or above:

sudo systemctl start apache2.service

sudo systemctl stop apache2.service

sudo systemctl restart apache2.service

sudo systemctl status apache2.service

CentOS/RHEL (Red Hat) Linux version 4.x/5.x/6.x:

## Start ##
service httpd start
## Stop ##
service httpd stop
## Restart ##
service httpd restart

CentOS/Fedora/RHEL (Red Hat) Linux version 7.x or newer:

## Start command ##
sudo systemctl start httpd.service
## Stop command ##
sudo systemctl stop httpd.service
## Restart command ##
sudo systemctl restart httpd.service

Alpine Linux:

service apache2 start
service apache2 stop
service apache2 status
service apache2 restart

Tuesday, September 20, 2022

Two-Factor Authentication (2FA) for Webmin with Google Authenticator

First install Perl Modules :

Then follow the instructions as given through the URL:

Install Perl CPAN Module in CentOS 8

dnf install perl-CPAN

dnf install "@Development Tools"

perl -MCPAN -e 'install Authen::OATH'

cpan -i Geo::IP OR 
cpan Geo::IP

cpan[1]> install Log::Log4perl


You need gcc.:
yum install gcc

yum install CPAN

Configure CPAN ( just run CPAN ):

After CPAN is configured:
install Authen::OATH [module in CPAN shell, which takes a long time to complete.]

When Authen::OATH is successfully installed, configure 2FA in WebMin.

Permission denied (publickey) fix

$ ls -laZ

$ restorecon -r -vv /home/user/.ssh

Monday, September 19, 2022

Friday, September 16, 2022

Installing PHP 7.4 on macOS Sierra without brew?

 sudo port install php74

sudo port install php74-cgi php74-gd php74-curl php74-intl php74-iconv php74-gettext php74-mbstring php74-imap php74-mcrypt php74-xmlrpc php74-mysql php74-openssl php74-sockets php74-zip php74-tidy php74-opcache php74-xsl php74-sqlite
sudo port select php php74

Thursday, September 15, 2022

How to remove directory in Linux

 To permanently remove a directory in Linux, use either rmdir or rm command:

  • For empty directories, use rmdir [dirname] or rm -d [dirname]
  • For non-empty directories, use rm -r [dirname]

Before you remove a directory, you need to know the name of it. To discover files and directories, use the ls command, and to know the current directory you are in, use the pwd command.

The options you use together with these commands are also important to determine how they work. Here’s a quick recap of rm command options:

Command and OptionDescription
rm -dRemove an empty directory using the rm command.
rm -rRemove a non-empty directory and its content.
rm -fIgnore any prompt when deleting a write-protected file.
rm -rfIgnore any prompt when deleting a write-protected non-empty folder.
rm -iOutput a prompt before deleting every file.
rm -IOutput a prompt only once before deleting more than three files.
rm *Wildcard that represents multiple characters.
rm ?Wildcard that represents a single character.
rmdir -pRemove an empty subdirectory and its parent directory.
rmdir -vPrint the information that the specified directory was deleted.

/usr/bin/env: 'php': No such file or directory CentOS Stream

sudo ln -s /usr/bin/php* /usr/bin/php

*= your current php version

Convert from CentOS Linux 8 to CentOS Stream 8

dnf --disablerepo '*' --enablerepo extras swap centos-linux-repos centos-stream-repos

dnf distro-sync



Monday, September 12, 2022

Reset MySQL Root Password on Red Hat Enterprise Linux 8

sudo systemctl stop mysqld

sudo systemctl set-environment MYSQLD_OPTS=”--skip-grant-tables”

sudo systemctl start mysqld

sudo mysql -u root


mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewRootPassw0rd!'; 


mysql> QUIT;

sudo systemctl stop mysqld

sudo systemctl unset-environment MYSQLD_OPTS

sudo systemctl start mysqld

sudo mysql -u root -p

mysql> QUIT;

sudo mysql -u root -p

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'ChangeRootPassw0rd!';

mysql> ALTER USER 'shola'@'localhost' IDENTIFIED BY 'ChangeSholaPassw0rd!';


mysql> QUIT;

Now login again with new root password !!

Sunday, September 11, 2022

Make PPK to Pem using Mac terminal

sudo port install putty
brew install putty

This will also install puttygen. To get puttygen to output a .PEM file:
puttygen privatekey.ppk -O private-openssh -o privatekey.pem

Once you have the key, open a terminal window and:
ssh -i privatekey.pem user@my.server.com

The private key must have tight security settings otherwise SSH complains. Make sure only the user can read the key.

chmod go-rw privatekey.pem

Sunday, September 4, 2022

How to access EC2 instance if lost key Pair and root credentials


Create a new instance with same OS as previous one or create it from AIM made from old instance


Shutdown the old instance and detach the volume


Shutdown new instance Attached the detached volume to new instance and start the instance


Login new instance using ssh console

Run the following commands:


df -h

cd mnt

mkdir oldvolume

sudo mount /dev/sda1 mnt/oldvolume

cd mnt/oldvolume/root/.ssh

sudo vi authorized_keys

Now add your public key and save 

umount /dev/sda1

sudo shutdown now


Now detach the dev/sda1 volume from new instance and attach to old instance as dev/sda


Reboot old instance from AWS dashboard and login your old instance using ssh console 

 Note: Your old instance IP will be changed after doing this if no elastic IP

Friday, September 2, 2022

Install NVM (Node Version Manager) on macOS with Homebrew

Step - 1:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo "# Homebrew\nexport PATH=/opt/homebrew/bin:\$PATH" >> .bash_profile
source ~/.bash_profile

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo "# Homebrew\nexport PATH=/opt/homebrew/bin:\$PATH" >> .zshrc
source ~/.zshrc

Step - 1:

brew update
brew install nvm
mkdir ~/.nvm

echo "export NVM_DIR=~/.nvm\nsource \$(brew --prefix nvm)/nvm.sh" >> .bash_profile
source ~/.bash_profile
echo "export NVM_DIR=~/.nvm\nsource \$(brew --prefix nvm)/nvm.sh" >> .zshrc
source ~/.zshrc

nvm install 12.13.0
nvm install --lts

Wednesday, August 31, 2022

How to install and run MongoDB GUI on Ubuntu 20.04

The following are the different ways to install mongo-gui.

From npm:

Install the module globally using the command :

npm install -g mongo-gui

Then use the command to run the application


From github:

First of all, clone the mongo-gui repository using the command git clone https://github.com/arunbandari/mongo-gui or download the zip file from here.

Change the directory to mongo-gui 

cd mongo-gui

Install all the dependencies npm install

Start the application using either 

npm start or node server.js 

Note: Node.js must be installed on your machine to run this application

From Docker Hub:

Docker compose

version: '3'



    container_name: "mongo-gui"

    image: ugleiton/mongo-gui

    restart: always


      - "4321:4321"


      - MONGO_URL=mongodb://localhost:27017

Mongo GUI Usage

The commands mongo-gui and npm start or node server.js start the application with the following configuaration:

URL (-u): mongodb://localhost:27017

PORT (-p): 4321

and the application will be accesible at http://localhost:4321

To connect to any other mongodb instance, pass mongo connection string as an argument, eg:

Installed via npm: mongo-gui -u mongodb+srv://<username>:<password>@host/<dbnames>?retryWrites=true&w=majority'

Installed via github: (npm start --/node server.js) -u mongodb+srv://<username>:<password>@host/<dbnames>?retryWrites=true&w=majority'

Available options:

-u: url, mongo-gui tries to connect to this mongodb instance

-p: port, mongo-gui listens on this port

Tuesday, August 30, 2022

Failed to start mongod.service: Unit mongod.service not found Solved !

When I started MongoDB got an error as:

"Failed to start mongod.service: Unit mongod.service not found."

Check port and configuration

sudo nano /etc/mongod.conf

sudo systemctl unmask mongod

and re-run

sudo service mongod start

sudo service mongod status

sudo systemctl enable mongod

sudo service mongod restart

service mongod stop
#dont start mongod…instead…

systemctl start mongod
#then mongo command


How to install composer and use it on Ubuntu

sudo apt update
sudo apt install wget php-cli php-zip unzip
wget -O composer-setup.php https://getcomposer.org/installer
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
sudo php composer-setup.php --install-dir=/path/to/project
sudo composer self-update  
composer require nesbot/carbon

Install multiple PHP version on Ubuntu for Virtualmin

 Enable ondrej/php repository

LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php && apt-get update
Install additional PHP packages
apt-get install php*-{cgi,cli,fpm,pdo,gd,mbstring,mysqlnd,opcache,xml,zip} 

Note: php* should be replaced with a specific PHP version, i.e. php7.4, unless you really need to install all available additional PHP versions.

Configuring the second PHP Version in Virtualmin

Once you have completed the installation of a second PHP version on your server, you can verify that Virtualmin sees it by logging into Virtualmin, and clicking System Settings → Re-Check Config. You should see something like this:
The following PHP execution modes are available : fpm
The following PHP-FPM versions are available : 8.0.13 (php-fpm) 7.4.30 (php74-php-fpm) 8.2.0 (php82-php-fpm) 

You can configure which one is the default PHP version used on new Virtual Servers. The default is to use the newest available. You can change that default in System Settings → Server Templates → Default → PHP Options page.

Configuring Individual Virtual Servers

You can configure the PHP version being used for a specific Virtual Server by selecting Server Configuration → PHP Options.

Source: https://www.virtualmin.com/documentation/web/multiplephp/

How to Install Apache2 to make Web Server on Ubuntu 20.04

 sudo apt update

sudo apt install apache2

sudo systemctl is-active apache2

sudo systemctl is-enabled apache2

sudo systemctl status apache2

sudo systemctl stop apache2      #stop apache2

sudo systemctl start apache2     #start apache2

sudo systemctl restart apache2   #restart apache2

sudo systemctl reload apache2    #reload apache2

sudo systemctl disable apache2   #disable apache2

sudo systemctl enable apache2    #enable apache2

ls /etc/apache2/*

sudo vim /etc/apache2/apache2.conf 

ServerName webserver1.tecmint.com

sudo apache2ctl configtest

sudo systemctl restart apache2

sudo systemctl status apache2

sudo ufw allow http

sudo ufw allow https

sudo ufw reload


sudo ufw allow 80/tcp

sudo ufw allow 443/tcp

sudo ufw reload

ls /var/www/html/

sudo mkdir -p /var/www/html/olineit.info

sudo chown www-data:www-data -R /var/www/html/olineit.info

sudo chmod 775 -R /var/www/html/olineit.info

sudo vim /var/www/html/olineit.info/index.html

sudo vim /etc/apache2/sites-available/olineit.info.conf

sudo a2ensite olineit.info.conf

sudo systemctl reload apache2

Installing Virtualmin after webmin

Once Webmin is operational you can download and install the Virtualmin modules and theme in either RPM format (for RPM-based Linux distributions), deb format (for deb-based Linux distributions), or wbm format (for any other UNIX or Linux system), and install them using the Webmin Modules module found in Webmin:Webmin Configuration.



install any MTA like Postfix, Sendmail or Qmail

How to install and use multiple php versions on ubuntu 22.04

sudo apt-get update

sudo apt-get upgrade 

sudo apt-get install php7.0 php7.0-fpm

sudo apt-get install php7.0-mysql php7.0-mbstring php7.0-xml php7.0-gd php7.0-curl

sudo apt-get install php7.1 php7.1-fpm

sudo apt-get install php7.1-mysql php7.1-mbstring php7.1-xml php7.1-gd php7.1-curl

Monday, August 29, 2022

How to install NGINX and configure on Ubuntu 20.04

sudo apt-get update

sudo apt upgrade

sudo apt install nginx

sudo systemctl status nginx

sudo ufw allow http

sudo ufw reload

sudo systemctl status nginx

sudo systemctl stop nginx

sudo systemctl start nginx

sudo systemctl disable nginx

sudo systemctl enable nginx

sudo systemctl restart nginx

sudo systemctl reload nginx

sudo unlink /etc/nginx/sites-enabled/default

sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/

sudo nginx -t

sudo systemctl restart nginx

sudo mkdir /var/www/example.com

How to unzip tar.gz file in linux

sudo apt-get install zip

unzip file.zip -d destination_folder

unzip file.zip

tar -xf archive.tar.gz

Sunday, August 28, 2022

How To Set Up Nginx Virtual Hosts Server Blocks on Ubuntu 20.04

Follow the steps to Set Up Nginx Virtual Hosts Server Blocks on Ubuntu 20.04:

 1. Create New Document Root Directory

sudo mkdir -p /var/www/yourdomain.com/public

sudo chown -R $USER:$USER /var/www/yourdomain.com/public

sudo chmod -R 755 /var/www

2. Creating Pages

nano /var/www/yourdomain.com/public/index.html

3.Creating new site available or server block copied from existing/default domain:

sudo cp /etc/nginx/sites-available/defaultdomain.com /etc/nginx/sites-available/yourdomain.com

4.  Enabling  Server Blocks and Restart Nginx

sudo ln -s /etc/nginx/sites-available/yourdomain.com /etc/nginx/sites-enabled/

5. Restart Nginx

sudo nginx -t

sudo systemctl restart nginx

6. Modify Local hosts file (optional)

sudo nano /etc/hosts yourdomain.com www.yourdomain.com

7. Test website


Saturday, August 27, 2022

How to Enable SSH Keys Authentication

 cd /etc/ssh

sudo nano sshd_config

Uncomment the following lines

PubkeyAuthentication yes

AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2

Save & exit.

You can follow this topic also:

Fix ssh port 22 connection refused ubuntu

How to create authorized_keys file in linux with ssh folder

How to create authorized_keys file in linux with ssh folder

 ls -a | grep .ssh

mkdir ~/.ssh/

touch ~/.ssh/authorized_keys

sudo nano ~/.ssh/authorized_keys

Fix ssh port 22 connection refused ubuntu

sudo apt install openssh-server

sudo apt list --installed | grep openssh-server

sudo service ssh status

sudo service ssh start

sudo service ssh restart

ssh [username]@[remoteserver IP or hostname]

ssh -p [port_number] [username]@[ip_address]

sudo netstat -ltnp | grep sshd

ssh -p [2244] [username]@[ip_address]

sudo ufw allow port /tcp

sudo ufw allow 2244/tcp

sudo ufw reload

sudo ufw status

sudo apt install arping

ping <ip-address>

Thursday, August 25, 2022

How to add public key to authorized_keys ec2 instance Ubunutu Linux

 Step 1: Login into you AWS account and go to EC2 instances

Step 2: Select your instance and click connect

Step 2: Then click connect button at the bottom right corner

Step 3: Now a new tab will be opened with console as follows

Step 4: Copy your SSH public key then add the key to the following key file

Use this command in Mac/Windows powershell to copy your public key: pbcopy ~/.ssh/id_rsa.pub

nano ~/.ssh/authorized_keys

Step 5: Save and reboot then try to connect again with device from which public key generated.

Tuesday, August 23, 2022

Fix laravel SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock


his happens when two processes or more are trying to write to the same database table at the exact same time. Solutions can be complicated. Deadlocks are usually an application problem most of the time can either be solved by:
1. changing the logic of your code (e.g. use transactions) or
2. retrying the operation

      php artisan route:list
      php artisan view:clear
      php artisan cache:clear

Thursday, August 18, 2022

How to add SSH Public key to an existing Droplet or VM?

First copy your Public key using the following command: 

cat ~/.ssh/id_rsa.pub


pbcopy ~/.ssh/id_rsa.pub

Now login into your Droplet or VM and open the following file then paste your public key into authorized_keys file.

nano ~/.ssh/authorized_keys

Save the file and try to login from your local terminal.

Monday, August 15, 2022

Fix Adding new SSL virtual website .. .. certificate authority file is not valid : Data does not start with line -----BEGIN CERTIFICATE-- in virtualmin

Open the file at /etc/webmin/virtual-server/domains/13694005276497

Delete including 4 lines pointing to the 4 certificate files: ssl.cert, ssl.combined, ssl.everything & ssl.key

Then re-add the ssl.

Friday, August 12, 2022

How to generate SSH keys in Windows PowerShell

 Open your PowerShell and follow the steps:


ssh-keygen -b 4096


notepad C:\Users\WINUSER/.ssh/id_rsa.pub

Wednesday, August 10, 2022

How to check TCP, UDP Domain Socket using NetCat

 Install the netcat Using the fllowing command:

$ yum install nc      [On CentOS/RHEL]

$ dnf install nc      [On Fedora 22+ and RHEL 8]

$ sudo apt-get install Netcat      [On Debian/Ubuntu]

NetCat commands:

$ nc -v -w 2 z 22     #scan a single port


$ nc -v -w 2 z 22 80  #scan multiple ports


$ nc -v -w 2 z 20-25  #scan range of ports

How to merge a branch to main branch in Github.

In Terminal or Command Prompt:  git checkout main  [switch to main branch] git pull origin main  [grab latest updates from main branch] git ...