Archive for category Server
Problem: I bought a new VPS and did some configuration changes (e.g. hostname setting). I’ve installed some software and wanted to test if my settings are boot resistant. And every time the VPS was booting the files /etc/hosts and /etc/hostname was overridden by the defaults of the provider.
Reason: Virtuozzo (the software which virtualises my VPS) overrides those files at every time the VPS is booting.
Solution: Replacing the files /etc/hosts and /etc/hostname at boot-time.
The following description is applied for Ubuntu 14.04. Both replacements are implemented as upstart jobs.
Copy the /etc/hosts (e.g. /etc/hosts_my) and adapt it to your needs. Then create the file /etc/init/hosts.conf with the following content:
description "restore my hosts" start on startup exec cp /etc/hosts_my /etc/hosts
Copy the /etc/hostname (e.g. /etc/hostname_mod) and adapt it to your needs. Then edit the file /etc/init/hostname.conf and change the last exec command to:
exec hostname -b -F /etc/hostname_mod