Basic setup of VServer
June 26, 2012 Leave a comment
To play around a bit i choose to rent a VServer. Here’s about the basic setup:
The provider uses a software called SolusVM for the management. So after logging in the first step is to (re)install the OS which can be chosen from a long list of choices. In my case, Ubuntu 12.04 64bit was the choice.
The first step after the installation was a logon and an update of the packages with
apt-get update
which resulted in error messages because of the (not) setup of the servers dns resolution. As i want to keep the server uptodate easy and install packages without a lot of manual effort i tried to set the name resolution somehow. In the past that could be done by editing /etc/resolv.conf but it seems that times have changed and so I had to do it another way. The solution I used was to create the file /etc/network/interfaces.tail and add the line
dns-nameservers 8.8.8.8
(which seems to be one of Google’s public nameservers). A reboot afterwards and name resolution was working (maybe the reboot would not have been necessary, probably restart of the networking would have fixed it, too).
The next step was to create a user for SSH access and copy the public key of the user to the server.
Create new user on the vserver
useradd USERNAME -G sudo -m -s /bin/bash
Set password
passwd USERNAME
and afterwards in a terminal on the local machine
ssh-copy-id -i IDENTITYFILE USERNAME@MACHINE
Next, i disabled SSH root logons, disable SSH passsword logons in the file /etc/ssh/sshd_config.
Install nano and sudo
Inactivate root:
sudo passwd -d root
Next step is a basic protection of the SSH-Server with fail2ban.
apt-get install fail2ban
We continue with fixing some errors with locales:
export LANGUAGE=de_DE.UTF-8
export LANG=de_DE.UTF-8
export LC_ALL=de_DE.UTF-8
locale-gen de_DE.UTF-8
dpkg-reconfigure locales
Set the time from UTC to the correct local timezone:
dpkg-reconfigure tzdata