Set the correct timezone on your Linode

Linode Staff

While the hosts keep good time for the Linodes using ntp, it is important that you set the correct timezone for your Linode. Here's how:

The timezone under Linux is set by a symbolic link from /etc/localtime to a file in the /usr/share/zoneinfo directory that corresponds with what timezone you are in.

# ls /usr/share/zoneinfo/

Africa      Cuba     GMT0         Japan      Poland      UCT
America     EET      GMT-0        Kwajalein  Portugal    Universal
Antarctica  Egypt    GMT+0        Libya      posix       US
Arctic      Eire     Greenwich    MET        posixrules  UTC
Asia        EST      Hongkong     Mexico     PRC         WET
Atlantic    EST5EDT  HST          Mideast    PST8PDT     W-SU
Australia   Etc      Iceland      MST        right       zone.tab
Brazil      Europe   Indian       MST7MDT    ROC         Zulu
Canada      Factory  Iran         Navajo     ROK
CET         GB       iso3166.tab  NZ         Singapore
Chile       GB-Eire  Israel       NZ-CHAT    SystemV
CST6CDT     GMT      Jamaica      Pacific    Turkey
# ls /usr/share/zoneinfo/US/

Alaska    Arizona  Eastern       Hawaii          Michigan  Pacific
Aleutian  Central  East-Indiana  Indiana-Starke  Mountain  Samoa

For example, I want to set my Linux install to use US/Central timezone, so I would execute the following:

ln -sf /usr/share/zoneinfo/US/Central /etc/localtime

By default, the distros are set up for US/Eastern (I believe). Setting your correct timezone helps spread out the load when all the cron jobs fire off in the early mornings. Please do this. ;)

ln -sf /usr/share/zoneinfo/your/zone /etc/localtime

Thanks,

-Chris

8 Replies

The friendly way to do this (at least under Debian - not sure if it works the same way in other dists):

# tzconfig
Your current time zone is set to Europe/Copenhagen
Do you want to change that? [n]:

Press "y" and then simply answer the questions.

tzconfig also works for Ubuntu (not suprisingly)

Also, "timeconfig" serves the same purpose in slackware.

Since this has been bumped up, I thought I'd mention that Gentoo has a similar utility called tzselect. Just run it and answer the questions (contintent, country, and if asked, city). I'm not sure which other distros this one is available on, though.

Maybe I'm a bit of a contrarian here, but I run my Linode on UTC. This completely eliminates any ambiguity (e.g. daylight savings).

just a note, my server running ubuntu 8.04 does not use tzconfig but rather tzselect

I think 'dpkg-reconfigure tzdata' popped up when I first updated the repository lists and upgraded for the first time on my fresh Ubuntu linode. That's how I updated it…

I would like to set the timezone using StackScript. (for Ubuntu distributions)

How do I do so?

From many of the guides in the library:

E.g.:

http://library.linode.com/server-monito … .10-karmic">http://library.linode.com/server-monitoring/cacti/ubuntu-9.10-karmic

> dpkg-reconfigure tzdata

How do I tell it to select a specific timezone?

May be by some parameters?

Or chaning the symlinks did the same way?

user@localhost ~> sudo dpkg-reconfigure tzdata

Current default time zone: 'America/Chicago'
Local time is now: Thu Nov 29 15:33:51 CST 2018.
Universal Time is now: Thu Nov 29 21:33:51 UTC 2018.

user@localhost ~> date
Thu Nov 29 13:34:11 PST 2018
user@localhost ~>

Hi, I tried to change time zone of my linode to us/chicago time and command worked fine but when I check time using date command I see it again in PST.

Any idea?

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct