Getting Started with your new KVM VPS

So, you've just got your shiny new KVM VPS, and you're wondering where to go from there, this guide will take you through some of the basic steps which we recommend you do to ensure you make the most out of your VPS (the majority of this tutorial is aimed at Linux users). So let us get started.

Installing the OS

(note: this section is already included in the welcome e-mail)

1) Choose an OS; by default we have the CentOS 6 32bit ISO mounted. If you would like to install a different operating system, login to SolusVM, under the CDRom tab, unmount the CentOS 6 32-bit ISO and mount an ISO of your choice (if your preferred OS isn't available, submit a ticket with the name and a link and we will get it listed!).

2) Reboot your VPS; click the General tab and hit reboot. This will reboot the server with your preferred ISO, into its installation mode.

3) Open VNC; click the green "VNC" button in the middle of the page. If a pop up comes with a warning, tick "I accept the risk and want to run this application" and hit Run.

4) Install and configure your OS; once the VNC window is open, you will be able to install your OS just as you would on a normal computer. Usually there is a selection menu, and you would hit Install or Graphical Install. It will ask you for a few options such as language and hostname and networking options.

Some OS's may require a RAM increase, if you submit a ticket we will be able to temporarily increase your RAM for the installation.

5) Once installed, don't forget to unmount the ISO; to do this, just go back to the CDRom tab in SolusVM and hit unmount. It's also good to change the boot order to "(1) Hard Disk (2) CDROM"

Recently SolusVM has introduced support for KVM templates, we will start rolling them out soon, to re-install via that, it's even simpler;

1) Open the General tab in SolusVM, and click the Reinstall button.
2) Select your preferred OS and hit the Reinstall button.
3) Your new root password will be displayed, take note of that.
4) After a few minutes you should be able to login via SSH, if it takes longer you can watch its progress through VNC.

If you are using SolusVM templates, SolusVM sometimes generates invalid SSH host keys. To check if it affects you, restart sshd, if it says something similar to -"Cannot load host key: /etc/ssh/ssh_host_dsa_key" you need to do the following:

CentOS

rm /etc/ssh/ssh_host*
service sshd restart
 
Debian

dpkg-reconfigure openssh-server
service ssh restart

Networking

Firstly, we will tweak the network settings and optimize it.

1) Login to SolusVM using the details in your welcome e-mail.
2) Open the Settings tab, at the bottom of the page
3) Change the "Network Card" to "virtio" if it isn't done already.

VirtIO gives several benefits, due to KVM being isolated, virtio communicates directly with the hostnode for the interface to speed it up (basic explanation, it's much more complicated really). It will give you access to the full 1Gbit unlike some of the other cards.

On some operating systems DHCP is a hit and miss thing, in most cases it automatically gets your IP details, however in the case that it does not do so, submit a ticket requesting your network details e.g. gateway, netmask, etc. and we will guide you through how to configure it, be sure to include your OS type.

The next thing we can do to tweak, for Linux only, is to modify the sysctl configuration file which in turn modifies the kernel parameters. Run the following:

echo 'net.core.rmem_max=16777216' >> /etc/sysctl.conf
echo 'net.core.wmem_max=16777216' >> /etc/sysctl.conf
echo 'net.ipv4.tcp_rmem=4096 87380 16777216' >> /etc/sysctl.conf
echo 'net.ipv4.tcp_wmem=4096 65536 16777216' >> /etc/sysctl.conf
echo 'net.ipv4.tcp_max_syn_backlog = 262144' >> /etc/sysctl.conf
echo 'net.core.somaxconn = 262144' >> /etc/sysctl.conf
echo 'net.core.netdev_max_backlog = 30000' >> /etc/sysctl.conf

Then enter the following command sysctl -p, this will allow the changes to take place.

You should notice a good increase in the throughput.

Disk

Next we will take a look at the disk drivers and tweak the disk a little. So just as we did with the network, we will change the virtual disk card.

1) Login to SolusVM, as we did before.
2) Find the Settings tab, as we did before.
3) Change the "Disk Driver" to "VirtIO".

This is recommended, unless you are using an OS which does not support virtio, namely Windows, however you can install Windows with the IDE driver, and then after installation mount the "Windows Drivers (VirtIO)" ISO and install the drivers then do as we just mentioned. Doing so, will increase the IO performance and disk performance in general, on both Windows and Linux.

Next just as in the networking section, we have provided a few tweaks, this time we will use various commands to change the system settings. Run the following commands:

echo 0 > /sys/block/vda/queue/rotational
echo 0 > /sys/block/vda/queue/rq_affinity
echo noop > /sys/block/vda/queue/scheduler
echo "echo 0 > /sys/block/vda/queue/rotational" >> /etc/rc.local
echo "echo 0 > /sys/block/vda/queue/rq_affinity" >> /etc/rc.local
echo "echo noop > /sys/block/vda/queue/scheduler" >> /etc/rc.local
echo 'vm.swappiness=5' >> /etc/sysctl.conf
echo 'vm.vfs_cache_pressure=50' >> /etc/sysctl.conf

These commands assume that your disk is "vda" which it should be if you have selected VirtIO. Afterwards we can run sysctl -p as we did previously to make the chances come into effect.

Power off and Shutdown and tweaking your OS to work with those accordingly

You may have noticed two buttons in SolusVM, Power off and Shutdown, and you may think that they mean the same thing, but they don't. Power off merely forces your VPS to shut down, just like how holding your power button down for a few seconds would or pulling the plug on a physical server would. Shutdown on the other hand sends the OS an ACPI request to shutdown, allowing it to stop services and unmount drives safely. Sometimes when the acpi daemon is not installed this button will not work correctly. To install the acpi daemon:

CentOS

yum install acpid -y
chkconfig acpid on
service acpid start

Debian


apt-get install acpid -y
chkconfig acpid on
service acpid start

If the acpi daemon is working correctly you will see a notice such as the following:

Broadcast message from root@your-hostname
        (unknown) at 03:32 ...
The system is going down for halt NOW!


Clock Syncronization

KVM VPS's can sometimes have clock drift issues. This means that the time gradually becomes out of sync. To fix we will will add a cron to sync with an ntp server as follows:

CentOS

yum install ntpdate -y
nano /etc/crontab

Using your favourite text editors, append the following:

13 */8 * * * root ntpdate -u 0.us.pool.ntp.org >/dev/null

Debian


apt-get install ntpdate -y
nano /etc/crontab

Using your favourite text editors, append the following:

13 */8 * * * root ntpdate -u 0.us.pool.ntp.org >/dev/null

This will keep your time on sync. You may want to go on and set your timezone too, which you can do as follows by creating a symlink to /etc/localtime with a tz time zone of your choice:

cd /etc
ln -sf /usr/share/zoneinfo/Europe/London localtime

Of course you should replace Europe/London with your timezone, use the link provided above to find your timezone file. Afterwards you can check the date your system by using none other than the date command.

Of course this isn't a complete guide, but it's some things we think may be useful. If there's anything specifically you want mentioning, feel free to let us know.

~Humza
  • 55 Users Found This Useful
Was this answer helpful?

Related Articles

Virtual Server Management

You may have already seen we offer an addon to all of our Virtual Server packages for managment....

Simple steps to secure your new VPS

Securing your VPS is vital, people may think of hacking as happening to only elite systems such...

IPv6 addresses

If you would like to accquire an IPv6 /64 netblock, we would be happy to do so and provide...

Support SSH Key

If for any reason you think there is a need for our support team to enter your Virtual Server,...