To install it, you need to create an npm project by going to an empty folder, running npm init, and following its instructions. Once your project is ready, you should run
npm install --save-dev hardhat
To use your local installation of Hardhat, you need to use npx to run it (i.e. npx hardhat).
npx hardhat accounts
npx hardhat compile
npx hardhat test
npx hardhat run scripts/sample-script.js
https://cryptomarketpool.com/sample-solidity-smart-contract/