Changing the Time Zone in Ubuntu Gutsy
EDIT: Okay. Ignore this entire post because as it turns out it’s outrageously easy with
. Kudos to soundray.
I’m hosted with Slicehost — they’re cool cats that offer very affordable VPS hosting. This is my first venture into server administration so I imagine sometime in the next two weeks the whole thing is going to come crashing down and the datacentre will catch on fire.
It’s been going pretty smooth, actually. Slicehost has amazing documentation and a lovely wiki. I recently noticed however, that my server’s time zone was set to UTC and not my beloved EST …
I can triumphantly say I figured out how to change the time zone! Victory! It took a surprising amount of googling; that’s probably because you would normally chose the time zone when you’re installing Ubuntu or something — but I think in the case of VPS hosts your setup is based off of a pre-installed image? Who knows …
In any case, here’s how I did it:
- Check out the current date/time to see what it’s set to:
date
- I backed up the file currently setting the timezone:
sudo mv /etc/localtime ~/localtime-bk
- Check out the folder/subfolders containing all the time zones:
cd /usr/share/zoneinfo
. It’ll give you a list of folder names for locations. In my case I’m looking for something close to EST. So I opened up the “America” folder.
- Then I created a link between the time zone file I want and the file setting the time zone:
sudo ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
- I checked out the time again (
date
) and it had magically gone from UTC to EST. YAY!
After I bring down my server (it will inevitably happen) I’m sure this will come in handy. Haha. Honestly after changing the timezone I’m afraid that the system won’t reboot. Hah, so I’m going to avoid doing that for a while …
slicematt said:
Glad you’re with us, nice blog!
Ben said:
Thanks!
Rolf said:
The recommended way is to ‘sudo dpkg-reconfigure tzdata’
Regards
soundray
Ben said:
WOW. That is significantly easier! I wish I found that out sooner!
Thanks!
Darrin said:
Thanks for the post, was just looking for this info!
Step 4 had a type, had to change to “nano ln” to “sudo ln”
after that I was on EST!
I’m digging my new slicehost, moving all my dreamhost accounts over to it.
Ben said:
Woops! Good call on the typo, fixed.