These are very beginner questions. I just got an instance of VPS with no domain name yet. The only way I can access my VPS is through SSH to a static IP. (1) How do I register a domain name and host it on my VPS? I know I can register a domain at some 3rd party registrar like GoDaddy, but how do I host that on my VPS?(2) How do I set up an email server that send emails and receive emails through the domain I register? What software do I need and how should I config it? Thanks a lot in advance
Setting up domain name and email servers for VPS
domains;web hosting;email;vps
There's a few things you need to do so I'll try and break it down in steps in the same order as you have asked. Pointing your new domain to the VPS using GoDaddyGoDaddy has their own dns manager and getting it to work with your domain is really simple, simple change the A record within the DNS manager to point to the IP address of your VPS. Below is a picture to display what setting I'm referring too.GoDaddy IP VPS http://www.bybe.net/downloads/vps-godaddy-ip-a-record.jpgSetting up Email Though the DomainYou mention that you want to receive emails and send emails using the domain, though mentioned that you want to host the emails this can be resourceful for your VPS and demanding how many email accounts you want them a better way is to have a email server hosted by someone else, not only because they tend to be more reliable but the fact is your being eating resources. As you know Google have a free email service called Gmail but they also do a Google APPS service which is exactly the same as Gmail but you use your own domain with their service. You don't need to use the web login to read emails as the same as the standard accounts you can throw them into outlook if you choose. Google apps is free upto 10 users, and then you need to start paying - it'll say free trial when you head over too www.google.com/apps ignore this if your below 10 users its actually free for standard use.Below is a picture of what you need to do with the DNS with GoDaddy to send emails and receive though your server.GoDaddy and Google APPS MX Records http://www.bybe.net/downloads/mx-records-google-apps.jpgTo send emails from the website you can use a PHP SMTP method or you can use a standard method by just using sendmail (Apt-get install sendmail) which won't login to your Google apps and send the email as SPOOFED which most people use.  But SMTP avoids spam filters better.Optional - Setting up a FQDNShould at any stage you be asked to enter the a valid FQDN you should add it to prevent further issues. Since you have not mentioned what the VPS is running on Ill give you a few pages that will help on multiple distros and assuming that your using linux. You want to add the FQDN to your hosts via the /etc/hosts file. References below.https://askubuntu.com/questions/158957/how-to-set-the-fully-qualified-domain-name-in-12-04https://serverfault.com/questions/367492/how-is-the-fqdn-determinedhttps://serverfault.com/questions/331936/setting-the-hostname-fqdn-or-short-name