When you launch a new Linux server, whether it's an AWS EC2 instance or a local server, by default, the server time is not synced with the NTP server and most of the times the timezone is set to UTC.
In most cases server timing synchronizing with the NTP server is very important.
Following are the steps:
Install & Configure NTP
- Run the following command to install the NTP
sudo apt-get install ntp
- Open the
ntp.conf
file:
sudo vi /etc/ntp.conf
- Check if the NTP pool entries the same as below otherwise update it:
pool 0.ubuntu.pool.ntp.org iburst
pool 1.ubuntu.pool.ntp.org iburst
pool 2.ubuntu.pool.ntp.org iburst
pool 3.ubuntu.pool.ntp.org iburst
- Restart the NTP service
sudo service ntp restart
- Check the NTP service status by running the following command:
service ntp status
Set/Change timezone
- Let's say you want to change the timezone to AEDT
- You can set it by running the following command:
sudo timedatectl set-timezone Australia/ACT
- Restart the NTP service
sudo service ntp restart
- You can confirm the result by running the following command:
service ntp status
- and it should you the result like the following:
Top comments (0)