This is an old revision of the document!
NTP on Linux
Ubuntu 20.04
Show time and timezones
sudo timedatectl
List available timezones
sudo timedatectl list-timezones
Set timezone
sudo timedatectl set-timezone Europe/London
To view the current time and date, run the following command.
date
To set the time manually, use the following command (substitute letters to numbers as appropriate).
date MMDDhhmmYYYY
To tell the machine to sync with a time server to get the latest time, use the following command.
ntpdate pool.ntp.org
The time daeomon on CentOS is called ntpd. To install the ntpd daemon, run the following as root.
yum -y install ntpd
To ensure it runs on start up, run the following as root.
chkconfig ntpd on
To manually start ntpd, run the following as root.
service ntpd start
If the machine is a Linux VM in VirtualBox running on a Windows host and you want to set the time to some date in the future, you will need to prevent the VM automatically correcting the time. Shut the VM down and run this command in the Windows host.
vboxmanage setextradata MACHINENAME "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" "1"
]
