Thursday, September 15, 2022

/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> FLUSH PRIVILEGES;

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

mysql> FLUSH PRIVILEGES;

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> FLUSH PRIVILEGES;

mysql> QUIT;

Now login again with new root password !!

Sunday, September 11, 2022

Make PPK to Pem using Mac terminal

sudo port install putty
or
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

Step-1: 

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

Step-2: 

Shutdown the old instance and detach the volume

Step-3: 

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

Step-4: 

Login new instance using ssh console

Run the following commands:

lsblk

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

Step-5: 

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

Step-6:

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
or

/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
or
echo "export NVM_DIR=~/.nvm\nsource \$(brew --prefix nvm)/nvm.sh" >> .zshrc
source ~/.zshrc


nvm install 12.13.0
nvm install --lts

Office 2021 Activation using command

  @echo off title Activate Microsoft Office 2021 (ALL versions) for FREE - office.com&cls&echo =====================================...