If you're running Cpanel/WHM, this is very easy to do.
Login to the domain's cpanel, (not whm):
http:// mydomain.com/cpanel
scroll down.
You'll see 3/4'ths of the way down in the right column (using the standard cpanel template), Sub-Domains.
Click on that and add whatever domain you want.
Note that standard sub-domains in cpanel exist within the same domain public_html folder as the root domain. So, it is highly recommended that you use a very unique folder name for your sub-domain, something that is not easily guessed.
For instance, if you create images.mydomain.com as a subdomain, and use images as the folder to create it under, then entering mydomain.com/images will bring up that specific sub-domain.
I recommend using some random character set so it will flush to the bottom of your ftp/sftp directory display. Like This:
sub-domain: images.mydomain.com
folder: zzz123images
Note that creating a sub-domain in this quick and easy manner does not give you the option of offering specific ftp/sftp access to that directory only. That is, you can't enter
ftp:// images.mydomain.com and get access to it. You access this specific domain folder by
ftp://mydomain.com.
If you have Fantastico installed, it DOES recognize sub-domains, (BONUS!), and you can install any Fantastico package on any sub-domain.
Once you have created your sub-domain, you must also create a CNAME record in your DNS file (unless you've got a wild-card entry for anything.mydomain.com).
If you do have a wild-card entry, then propagation is immediate, so the sub-domain will be available immediately.
************************************************** ******
Add On Domains
************************************************** ******
The same Filebase.. hierarchy is also prevalent with 'Add On Domains' in your Cpanel interface. That is... if you add a new domain via Cpanel (NOT WHM), then the file container for it will be within mydomain.com public_html.
Example.
I've got mydomain.com, I want to a TLD (top level domain) to this same account in Cpanel, we'll call this newdomain.com. Click on Addon Domains (right after Sub-Domains in the Cpanel home page)...
You will be presented with a screen with blanks that asks for:
New Domain Name: newdomain.com
Subdomain/Ftp Username: newdomain (auto-fills)
Document Root: home/newdomain (auto-fills)
Password:
Again, here the location of the new domain is WITHIN the container of mydomain.com. So, when you fill in your New Domain Name, it will auto-fill the Subdomain/Ftp Username, as well as the document root entry. It is highly recommended that you override the Document Root with some obscure combination of characters to prevent it's functions from potentially interfering with the root mydomain.com. Something like ZZZblahblahinsert-obscure-directory-name-here.
If you want to add a domain this way (which is common-place for someone with a simple $5 a month hosting account with the addon domain feature enabled), then all that's left to do is point your dns host ip record to the server and then you're in business.
Unfortunately, with the current version of Cpanel, you cannot add a sub-domain using the Addon Domain (TLD) feature, you will get an error that says you cannot park a domain on top of itself. So, you're kinda stuck with using the sub-domain thing instead.
All that said, if you want a fully featured sub-domain or alternate TLD, with it's own designated directory space and ftp/sftp access, then it's best to create the entity via WHM instead of Cpanel. Yes, you can create a domain like images.mydomain.com account using WHM instead of Cpanel.
For you folks with development boxes and need help doing the same thing without a control panel like Cpanel just post your questions and I'll try to help you out.
Any questions, just ask.
