Setup datetime in linux from command line

To automaticaly configure datetime on a debian server, you'll need NTP server installed.

sudo apt-get install ntp

Reconfigure timezone

sudo dpkg-reconfigure tzdata

Automatic timezone configuration

export DEBIAN_FRONTEND=noninteractive
export DEBCONF_NONINTERACTIVE_SEEN=true

sudo ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
dpkg-reconfigure --frontend noninteractive tzdata