📜 ⬆️ ⬇️

Manual update of the time zone database in old Linux distributions

It may be that this note is useful for those marmot administrators who still ( oh, horror! ) Have not moved the system clock of their servers, allowing smart machines to set winter time. Yes, of course, we don’t treat you like this, and we patched our favorite OS in time, under which more than one website is running successfully.

But all this concerns the operating systems of the fresh versions, it was for them that the corresponding updates appeared on time. But what to do with dinosaurs, with those machines that have been tried and tested for years, serve us faithfully, and we were not honored to update the OS on them?

Update the time zone database manually.
This is easy and that is what this article will be about.
')
A manual update is provided using the Fedora 8 Linux distribution as an example (I think the example will also apply to Red Hat and CentOS distributions ). It is under this system that the web server is running on one of the machines that I look after.

So, we log in as an ordinary user via SSH and look at the current time (it is taken from the / etc / localtime file) and, immediately, the currently set time zone:

[user@server ~]$ date Fri Nov 18 18:59:57 MSK 2011 [user@server ~]$ cat /etc/sysconfig/clock | grep ZONE ZONE="Europe/Moscow" 

Here we automatically look at our “straw”, see a lag of one hour and immediately check if the transition to winter time was made for sure:

 [user@server ~]$ zdump -v /etc/localtime | grep 2011 Europe/Moscow Sat Mar 26 22:59:59 2011 UTC = Sun Mar 27 01:59:59 2011 MSK isdst=0 gmtoff=10800 Europe/Moscow Sat Mar 26 23:00:00 2011 UTC = Sun Mar 27 03:00:00 2011 MSD isdst=1 gmtoff=14400 Europe/Moscow Sat Oct 29 22:59:59 2011 UTC = Sun Oct 30 02:59:59 2011 MSD isdst=1 gmtoff=14400 Europe/Moscow Sat Oct 29 23:00:00 2011 UTC = Sun Oct 30 02:00:00 2011 MSK isdst=0 gmtoff=10800 

The lines with the October date confirm the fact that the transfer to winter time is now unnecessary (a detailed post about it was done by the habyle user GreyCat ).

To correct the situation, go to the IANA site (The Internet Assigned Numbers Authority) - it is there that the updated The Time Zone Database files are now published ( time zone databases also known among system administrators as tz database or zoneinfo database ) and download the tzdata file containing the latest updates. For downloading, it is more convenient to use utilities like wget or curl (which can be found at hand), rather than a browser:

 [user@server ~]$ wget http://www.iana.org/time-zones/repository/releases/tzdata2011n.tar.gz 
or
 [user@server ~]$ curl -O www.iana.org/time-zones/repository/releases/tzdata2011n.tar.gz 

Immediately unpack the contents of the downloaded tzdata file (you can go to the same directory where you downloaded it):

 [user@server ~]$ tar xzf tzdata2011n.tar.gz 

And finally, the most important thing.
We compile the Europe time zones file into a binary form and immediately make the / etc / localtime key file a symbolic link to the corresponding file (in this case, the Europe / Moscow belt), otherwise the system will not know that we have updated the database contents.

This command will require superuser rights, so you need to execute it as root :

 [root@server user]$ zic europe [root@server user]$ ln -sf --suffix=.backup /usr/share/zoneinfo/Europe/Moscow /etc/localtime 

That's all! We look at the time, now everything is displayed correctly:

 [root@server user]$ date Fri Nov 18 20:14:37 MSK 2011 

Source: https://habr.com/ru/post/133240/


All Articles