Perfect Server Ubuntu 12.04 VPS with Webmin & Virtualmin How To Guide

Perfect Server Ubuntu 12.04 VPS with Webmin & Virtualmin How To Guide
Photo by Hal Gatewood / Unsplash

How-To on installing and setting up a Perfect Server running Ubuntu 12.04 LTS (Long Term Support) 64-bit and installing Virtualmin and running multiple domain names. You will need to purchase a VPS (Virtual Private Server), for hosting all your services. The minimum recommended hardware specs should really be no less than 1GB RAM, allowing hosting of multiple sites even with MySQL databases.

If you are wanting to host email on the server then additional resources may be required, and knowledge also.

Setting Up A Perfect Server using Ubuntu

Choose Ubuntu 12.04 64-bit as a pre-installed image on your server and setup a root password (This may or may not have been supplied to you when you purchased your server hosting).

Also you will need to make note of the server ip address to gain access to your server. We will be connecting to the server using SSH (secure shell)

Putty for Windows -or- Terminal for Linux & Mac

Log into server via ssh on port number 22 (Port 22 is the default for SSH) as the username supplied to or setup by you.
(replace 123.456.789.101 with your server ip address)

ssh -p22 [email protected]

Set the system language to English (locale)

sudo apt-get install language-pack-en-base 
sudo dpkg-reconfigure locales

Configure the servers timezone to GMT (If you are based in the UK)

sudo dpkg-reconfigure tzdata

Run system update command

sudo apt-get update && sudo apt-get upgrade -y

Check the hostname of system, then edit if required;

hostname 
sudo vi /etc/hostname

Press “ I ” on keyboard to enter insert text mode and edit hostname to be in the FQDN (fully qualified domain name) format;

hostname.domainname.co.uk

Press “Esc” on keyboard to exit insert text mode Press “:wq” on keyboard towrite file and quit vi.

Next we issue the command which sets the hostname across the server

sudo hostname -F /etc/hostname

Next thing to edit is the hosts file, so; (replace 123.456.789.101 with your server ip address)

sudo vi /etc/hosts

127.0.0.1 localhost
123.456.789.101 hostname.domainname.co.uk hostname

Then we edit the resolv.conf file and add the dns servers, adding 127.0.0.1

sudo vi /etc/resolv.conf

nameserver 127.0.0.1
nameserver 8.8.8.8
nameserver 8.8.4.4

Now, reload the resolvconf

sudo service resolvconf restart

Virtualmin & Webmin Setting Up

Install scponly so we don’t run into any errors whilst installing virtualmin

cd /tmp 
sudo wget http://security.ubuntu.com/ubuntu/pool/universe/s/scponly/scponly_4.8-4.1_i386.deb 
sudo dpkg -i scponly_4.8-4.1_i386.deb

Virtualmin is the next one up, the automated install script works a treat

sudo -s
cd /tmp 
wget http://software.virtualmin.com/gpl/scripts/install.sh 
chmod u+x install.sh 
sh ./install.sh

Once Virtualmin is installed it is accessible in a web browser via
http://hostname.domainname.co.uk:10000

The Virtualmin post installation wizard will guide you through, leave everything to defaults except passwords. Choose to store passwords via hashed encryption for security purposes.

The next thing to do is consider hardening the server for protection against hacking, which you can read more about here.