gpg --gen-key
If need some entropy to generate random number, install random number tool
sudo apt-get install rng-tools
to set it up.Then run
sudo rngd -r /dev/urandom
before generating the keys.How to export GPG private key.
gpg --export-secret-key -a USER_ID_HERE > GPG_KEY_FILE_NAME