Setting Up Your Website and Email on Digital Ocean

This blog is about how I went about setting up my website and email on Digital Ocean. It is a continuation from my previous article about the decision to move from shared hosting to a VPS.

My requirements are:

  1. Run my personal website
  2. Run my own email server
Note: The following guide assumes that you have basic understanding of VPS, Ubuntu, Webservers, Database, Webhosting etc
Step 1 : Create A Digital Ocean Droplet
You have to select the size of your Droplet, the physical location and an operating system. I chose the 1GB package, Singapore as the location and Ubuntu as my Operating System. Click here to get $10 free credit from Digital Ocean. It is enough to let your try out for a month.
Digital ocean lets you one click install applications like – LAMP/LEMP Stack, WordPress on Ubuntu etc.
DO_Droplet
DO_Region
DO_OS
I did not choose the preconfigured stacks because sometimes it creates issues while installing your applications.
Once your Droplet is ready, the IP address, root password is mailed to you.

Step 2 : Install Webmin and Virtualmin

Webmin is a web-based interface for system administration for Unix. Using any modern browser you can setup user accounts, Apache, DNS, file sharing and so on. Webmin consists of a simple web server, and a number of CGI programs which directly update system files. The web server and all CGI programs are written in Perl.
Installing webmin is pretty straightforward. Both Digital Ocean and Webmin has good guides on how to do this. In short, you add the repository and install webmin.
Edit the /etc/apt/sources.list file using
sudo nano /etc/apt/sources.list
Add the following repos
deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
DO_source.list_
Download and install the GPG key with which the repository is signed
wget http://www.webmin.com/jcameron-key.asc
apt-key add jcameron-key.asc
Install Webmin using the following commands
apt-get update
apt-get install webmin
Once installed, Webmin is accessible at http://your_ip_address:10000 . You can log in with as root or any other user with root previliges and access webmin.
DO_Webmin_Login
Webmin alone, however, was not enough. I needed Virtualmin on top of Webmin.
Virtualmin is a web hosting control panel based on Webmin. You can manage your virtual domains, mailboxes, databases, applications, and the entire server, from the Virutalmin interface.
You can download the installer script using
wget http://software.virtualmin.com/gpl/scripts/install.sh -O /root/virtualmin-install.sh and
install it using
sh /root/virtualmin-install.sh
Once installed, Virtualmin can be accesssed at http://your_ip_address:10000.
The Post-Installation Wizard will run and it is self-explanatory.

Step 3 : Creating your Virtual Server

Login into Webmin and click Create Virtual Server
DO_Create_Virtual_Server_Virtualmin
Fill in all the relevant fields and enable the features you might need and create the server.
Virtualmin is pretty solid. It creates your home directory, DNS entries etc as you create the Virtual Server.
Step 4 : Update your DNS entries.
This has to be updated at two places
  • With your Domain provider
  • In the Digital Ocean control panel

Step 5 : Install add-ons

I use Roundcube for emails, Phpmyadmin to managed the MySql databases and Virutalmin makes it easy. Click on install Scripts. Choose your script and the location where you want it installed.
DO_roundcube
If you had done the above, then your email will be accessbile at
http://your_ip_address/roundcube
You can create users/email accounts from Virutalmin and log in via Roundcube.

Step 6 : Secure Your Server

This is a tricky part and there are a bunch of things one can do. The most basic ones include
  1. Disable remote login for root
  2. Secure Mysql and Phpmyadmin
  3. Implementing intrusion detection
  4. Use SFTP instead of FTP
 This comprehensive article on Linux server safety by Digital Ocean is a great place to start.
https://www.digitalocean.com/community/tutorials/an-introduction-to-securing-your-linux-vps