General
How To: Set the Timezone on Ubuntu (Server)
Posted on .Like most server administrators, I find myself needing to analyse server logs for some reason. It’s pretty annoying when you view log files in an attempt to make sense of your data only to find the time-stamps on events don’t correspond to your local time.
To check your time-zone, use “date”:
root@n3rve:~# date
Mon Feb 2 16:29:07 WAT 2015
You can also check the time-zone by viewing the content of /etc/timezone
root@n3rve:~# cat /etc/timezone
Africa/Lagos
To change the time/timezone, we use the dpkg-reconfigure command:
root@n3rve:~# dpkg-reconfigure tzdata
Use the arrow keys to highlight your preferred timezone, press TAB and ENTER. Highlight and select your City/Region. You will get a confirmation acknowledging the update:
Current default time zone: 'Africa/Lagos'
Local time is now: Mon Feb 2 16:25:53 WAT 2015.
Universal time is now: Mon Feb 2 16:25:53 UTC 2015.
You may need to prepend those commands with ‘sudo’, assuming you’re not logged in as root. I suggest rebooting the system after making the change too. I hope that resolves it for you. If you have any contributions, let’s hear you in the comments.