Hello Ujjwal Pratap singh
Welcome to Microsoft Q&A Platform, thanks for posting your query here.
As you mentioned you need to install Nginx, I assume you are using a Linux distribution that supports the 'apt' package manager (such as Debian, Ubuntu, or their derivatives). If you are using a different distribution, the package manager and commands may differ, and you should use the appropriate package manager for your system.
Here's how you can fix the "apt-get command not found" issue on a system that should have 'apt' installed:
Step:1 - Confirm whether 'apt-get' is already installed on your system by running the command:
which apt-get
If it does not return anything, then Install 'apt' as mentioned below.
Try installing the package that provides 'apt-get' using the package manager specific to your Linux distribution.
sudo apt update
sudo apt install apt
If the command (Step:1) returns a path (e.g., /usr/bin/apt-get
), it means 'apt-get' is installed, and the issue might be related to your system's PATH configuration.
To ensure that the 'apt-get' binary is accessible from your shell, you can add its location to your PATH.
Open your shell configuration file (such as ~/.bashrc, ~/.bash_profile, ~/.zshrc, or ~/.profile) with a text editor like 'nano' or 'vim'. For example:
nano ~/.bashrc
Add the following line to the file if it's not already there, save the file and exit the text editor.
export PATH="/usr/bin:$PATH"
Apply the changes to your current shell session:
source ~/.bashrc # or source ~/.bash_profile, source ~/.zshrc, etc., depending on your configuration file
Verify 'apt-get' installation
apt-get update
It should work without any errors.
Hope this helps.