Setting the timezone: Difference between revisions

From Alpine Linux
No edit summary
(Rewrite completely outdated article)
Line 1: Line 1:
{{Obsolete}}
Timezone can easily be configured with the [[Setup-alpine#setup-timezone|setup-timezone]]  script.


Timezone setting is now handled by [[Setup-alpine#setup-timezone]]
The approach below is only convenient for systems that need frequent timezone changes, potentially while offline.


------
= Manual configuration=


{{Note|Only for NON uclibc installs!!!}}
Timezone data files are provided by te {{Pkg|tzdata}} package. The current timezone is defined in the <code>/etc/localtime</code> file. To change the timezone, make this file a link to another timezone data file. For example:
 
glibc based installs use different timezone setup.


  apk add tzdata
  apk add tzdata
  ls /usr/share/zoneinfo
  ln -s /usr/share/zoneinfo/Europe/Brussels /etc/localtime
Suppose you want to use Brussels
First copy the proper zone to localtime
cp /usr/share/zoneinfo/Europe/Brussels /etc/localtime
Now specify your timezone
echo "Europe/Brussels" >  /etc/timezone
date
Result: Wed Mar  8 00:46:05 CET 2006
 
You can now remove the other timezones
apk del tzdata
 


[[Category:System Administration]]
[[Category:System Administration]]

Revision as of 23:15, 9 November 2023

Timezone can easily be configured with the setup-timezone script.

The approach below is only convenient for systems that need frequent timezone changes, potentially while offline.

Manual configuration

Timezone data files are provided by te tzdata package. The current timezone is defined in the /etc/localtime file. To change the timezone, make this file a link to another timezone data file. For example:

apk add tzdata
ln -s /usr/share/zoneinfo/Europe/Brussels /etc/localtime