21 Year old AD airman Here.
Buying it from a friend is fine, to remain lawful you should go to the nearest metro sub-station and register it. There is one about 10 minutes from base. You don't need to be 21, just 18.
You may carry it without permit OPENLY, however if you wish to conceal it at all you will need to obtain a permit(Which of course, you can't get until 21). If you have not already, I suggest you spent a good amount of time lurking the forums and you should find out a whole lot of information. There is a lot about carrying etiquette that can be found in here. Stay safe, stay respectful, and know your rights.