I just bought a domain mydomain.com and a vps cpanel / whm. I am wondering how could I get nameservers as ns1.mydomain.com and ns2.mydomain.com for the mydomain.com itself? Having secondary nameserver outside is the really possible way to do that?
Name servers can usually be registered with the organization you purchased the domain through (for example, NetSol has an FAQ here, eNom has a link on their front page under 'domains | advanced tools'). Sometimes it is tucked away somewhere in the domain management utilities, but they usually offer the feature. You should check with their support pages, or contact their support team.
As somebody else mentioned, you don't have to have it registered under the same domain name that is hosting the domain.
Hope that answers the question.
The name servers of your domain do not have to be within that domain. You can have ns1.example.com be a nameserver for tailspintoys.com
The nameservers can be within the domain because the root domain (.com for example) can keep glue records, keeping track of the IP of ns1.example.com, so when someone goes looking for example.com, ns1 can be found.