The easiest method is to create a vanilla onion service, e.g.:
HiddenServiceDir /var/lib/tor/onion
HiddenServicePort 80
Then start the tor
service, let it finish loading, then stop the tor
service.
Now edit the file /var/lib/tor/onion/private_key
and replace the private key in the file with the one you've generated and save the file, then start Tor.
The public key isn't needed since the private key already contains all the information that the public key does.
Now when you start the tor
service again, you should see your custom hostname has been written to the /var/lib/tor/onion/hostname
file (where it previously had the one Tor generated for you).
The reason I'd recommend this path is that Tor is picky about permissions on the files and folders, to ensure that only the user tor
is running as can read the keys, so this lets tor
create the files and folder with the right permissions for you. All you need to do is replace the contents of the private_key
file.
The RSA private key should be stored in PEM format.