
Run the timedatectl command again to make sure that everything is synchronized. If you want to make sure of it, you can still run the following command. Note that you don’t have to set the activate the NTP protocol for the timedatectl command as starting chrony will automatically desactivate the systemd-timesync daemon in order to use NTP. Now that chrony is installed on your system, you can change your system date by adjusting the timezone of your system. Verify the status of your service with the status command. To enable and start the chrony service, you have to run the following commands. In most of the cases, the chrony service might be installed by default on your distribution.

#SETDATE FOR HOUR INSTALL#
Then, install the chrony package using YUM. Next, make sure that your packages are up to date on your server. To set the date, you are going to use the chrony service.įirst of all, make sure that the timesyncd service is not running on your host. Using the NTP protocol, you will be able to have a very precise date on Linux.

You will use reference time servers that will be synchronized to your own server by computing latencies to contact reference servers. The most accurate way to set the date on Linux is to use the ntp protocol.Īs a quick reminder, the NTP protocol is used in order to synchronize time between different servers over a network. If you prefer using chrony or NTP, the next sections describe how you can set NTP and chrony in order to synchronize your system date.

To enable time synchronization, simply run this command. The main difference between systemd-timesync and NTP is that the daemon only implements a client-side and it is not using complex mechanisms like NTP. However, your current date is not synchronized yet, you will have to activate the NTP service in order for it to synchronize.īy default, if you are working with a distribution with systemd, you should have the systemd-timesync daemon by default. In order to check your current system date, you have to run the timedatectl command again. $ timedatectl set-timezone America/New_York To set the timezone, use the “ set-timezone” command. To set your timezone to New York, you can search for it easily using grep. $ timedatectl list-timezonesĪs you can see, timezones are presented using the following syntax : continent/region. To list timezones on Linux, use the “ list-timezones” option with timedatectl. In order to consult your current timezone on Linux, you can run the timedatectl command. If your timezone is badly configured, you will need to modify your timezone information. If you don’t use the NTP protocol (with ntpd or chrony), your system will use the timesync service by default. To set the date, you need to set your timezone information and to (optionally) activate the NTP protocol in order for your system to synchronize with NTP servers. Whether you are working on Debian/Ubuntu or on RHEL/CentOS, the way to set the date is the same. If you don’t have sudo privileges on your account, follow this tutorial to get sudo on Debian based systems, or on Red Hat based systems (CentOS, RHEL) Set date on Linux using timedatectl User user may run the following commands on localhost: To make sure of it, you can run the following command $ sudo -l Synchronize your hardware clock with your system dateīefore starting, you will need to have sudo privileges on your host in order to perform some of the commands.

Set date on Linux using the date command.
