How to change package installation location

I am very new to it. I didn’t get how to do it. Can you give a example like what and command to use in detail?