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 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
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.


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 


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/

sudo chown www-data:www-data -R /var/www/html/

sudo chmod 775 -R /var/www/html/

sudo vim /var/www/html/

sudo vim /etc/apache2/sites-available/

sudo a2ensite

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/ /etc/nginx/sites-enabled/

sudo nginx -t

sudo systemctl restart nginx

sudo mkdir /var/www/

How to unzip tar.gz file in linux

sudo apt-get install zip

unzip -d destination_folder


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/

sudo chown -R $USER:$USER /var/www/

sudo chmod -R 755 /var/www

2. Creating Pages

nano /var/www/

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

sudo cp /etc/nginx/sites-available/ /etc/nginx/sites-available/

4.  Enabling  Server Blocks and Restart Nginx

sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/

5. Restart Nginx

sudo nginx -t

sudo systemctl restart nginx

6. Modify Local hosts file (optional)

sudo nano /etc/hosts

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/

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/


pbcopy ~/.ssh/

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/

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

Saturday, August 6, 2022

How to hide IP in header from Postal MTA

Remove  text where need using the following file in postalMTA.

For SMTP Server:


@receiving_headers = true
received_header_content = "from #{@helo_name} (#{@hostname} [#{@ip_address}]) by #{Postal.config.dns.smtp_server_hostname} with SMTP;



mail.header['Received'] = "from #{@source_type} (#{self.resolved_hostname} [#{@ip}]) by Postal with HTTP; #{}"
mail.message_id = "<#{@message_id}>"

How to view saved password in Outlook 2003, 2007, 2010, 2013, 2016, 2019

Use Unmask Password Tool to reveal hidden behind the asterisk icon.


Download from Google Drive

Download from CNET


To see if the password is available, first open the “Keychain Access” program on your Mac (click the Go menu in the Finder and choose Applications, then open Utilities and Keychain Access).

Thursday, August 4, 2022

Office 2019 Activation without Product Key using CMD

Put the following code in a TXT file and save as "file.cmd" then run the cmd file as administrator. 

@echo off

title Activate Microsoft Office 2019 ALL versions for FREE!&cls&echo ============================================================================&echo #Project: Activating Microsoft software products for FREE without software&echo ============================================================================&echo.&echo #Supported products:&echo - Microsoft Office Standard 2019&echo - Microsoft Office Professional Plus 2019&echo.&echo.&(if exist "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles%\Microsoft Office\Office16")&(if exist "%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16")&(for /f %%x in ('dir /b ..\root\Licenses16\ProPlus2019VL*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&(for /f %%x in ('dir /b ..\root\Licenses16\ProPlus2019VL*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&echo.&echo ============================================================================&echo Activating your Office...&cscript //nologo ospp.vbs /unpkey:6MWKP >nul&cscript //nologo ospp.vbs /inpkey:NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP >nul&set i=1


if %i%==1 set

if %i%==2 set

if %i%==3 set

if %i%==4 goto notsupported

cscript //nologo ospp.vbs /sethst:%KMS_Sev% >nul&echo ============================================================================&echo.&echo.

cscript //nologo ospp.vbs /act | find /i "successful" && (echo.&echo ============================================================================&echo.&echo #My official blog: #How it works: #Please feel free to contact me at if you have any questions or concerns.&echo.&echo #Please consider supporting this project: #Your support is helping me keep my servers running everyday!&echo.&echo ============================================================================&choice /n /c YN /m "Would you like to visit my blog [Y,N]?" & if errorlevel 2 exit) || (echo The connection to my KMS server failed! Trying to connect to another one... & echo Please wait... & echo. & echo. & set /a i+=1 & goto server)

explorer ""&goto halt


echo.&echo ============================================================================&echo Sorry! Your version is not supported.&echo Please try installing the latest version here:


pause >nul

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 ...