Step-1 Install ganache gui interface or ganache-cli by command prompt. With each test account you will get 100 ether for performing transaction in localhost.It runs on 127.0.0.1 (localhost) and port 7545 . Make sure this setting is updated in truffle.config if you are using truffle project .
Step-2 Choose private key by click on key option and create private network in meta mask by providing url http://127.0.0.1:7545.
Create private network in metamask ,Previously ChainID was optional field but in recent release of metamask they made mandatory . By default for localhost chain ID would be 1337
Step-3 – Import private key to connect to localhost account.
Step-4 – After paste private key click on import and metamask will be connected to localhost test account to perform transactions.