Debian – Change date time to PST and sync using NTP

I installed a server that showed time in UTC. I wanted to change the zone to PST and also have the time sync with a trusted source for which I used NTP service. Here’s what you need to do:

1. Remove the localtime file that keeps track of the timezone

rm /etc/localtime

2. Link localtime to other existing timezones. All US timezones are located under under the /usr/share/zoneinfo/US directory. Link the Pacific time to the localtime

cd /etc
ln -s /usr/share/zoneinfo/US/Pacific localtime

3. Now execute the date command and you’ll see the time in PST

# Thu Jun  2 12:01:41 PDT 2016

4. Install NTP to sync time

apt-get install ntp

5. Make sure your computer’s clock is set to something sensible (within a few minutes of the ‘true’ time). Just check your computer’s time or your wristwatch and modify the approximate time on the server using

date --set 12:20:00

6. Now restart the NTP services

/etc/init.d/ntp restart

After the minute completes, check the date command and you’ll notice that the time is now synced accurately with a trusted ntp server.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s