Setting the timezone: Difference between revisions

From Alpine Linux
m (→‎Manual configuration: Use path and pkg templates.)
(changed heading levels and integrated the recently added content by John3-16 with additional headings)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Timezone can easily be configured with the [[Setup-alpine#setup-timezone|setup-timezone]] script.
This page documents various approaches to set the timezone in Alpine Linux. The timezone is typically set up at [[Installation#Base_configuration|install]] with the [[Setup-alpine#setup-timezone|setup-timezone]] script as part of [[Alpine_setup_scripts#setup-alpine|setup-alpine]] script.
== Installation ==


The approach below is only convenient for systems that need frequent timezone changes, potentially while offline.
Timezone data files are provided by the {{Pkg|tzdata}} package. It is installed as a dependency to various packages, including {{Pkg|qt6-qtbase}} and {{Pkg|swaybar}}, but if it is missing, install it as follows: {{Cmd|# apk add {{pkg|tzdata|arch=}}}}
 
== Using setup-timezone script ==
 
Timezone can be configured anytime using the [[Setup-alpine#setup-timezone|setup-timezone]] script.
 
== Using desktop tools ==
 
If and when a [[Tutorials_and_Howtos#Desktop|desktop environment (DE)]] is eventually set up, consider using a setting there from then onwards to adjust for: (a) a change of timezone;  and (b) whether it should adjust for Daylight Saving Time, Summer Time, etc.  This helps to preserve the DE's approach on handling and displaying the clock.


= Manual configuration=
== Manual configuration ==


Timezone data files are provided by te {{Pkg|tzdata}} package. The current timezone is defined in the {{path|/etc/localtime}} file. To change the timezone, make this file a link to another timezone data file. For example:
The approach below is only convenient for systems that need frequent timezone changes, potentially while offline.


apk add {{pkg|tzdata|arch=}}
Ensure that {{Pkg|tzdata}} package is [[#Installation|installed]]. The current timezone is defined in the {{path|/etc/localtime}} file. To change the timezone, make this file a link to another timezone data file. For example: {{Cmd|# ln -s /usr/share/zoneinfo/Europe/Brussels /etc/localtime}}
ln -s /usr/share/zoneinfo/Europe/Brussels /etc/localtime


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

Latest revision as of 03:41, 3 November 2025

This page documents various approaches to set the timezone in Alpine Linux. The timezone is typically set up at install with the setup-timezone script as part of setup-alpine script.

Installation

Timezone data files are provided by the tzdata package. It is installed as a dependency to various packages, including qt6-qtbase and swaybar, but if it is missing, install it as follows:

# apk add tzdata

Using setup-timezone script

Timezone can be configured anytime using the setup-timezone script.

Using desktop tools

If and when a desktop environment (DE) is eventually set up, consider using a setting there from then onwards to adjust for: (a) a change of timezone; and (b) whether it should adjust for Daylight Saving Time, Summer Time, etc. This helps to preserve the DE's approach on handling and displaying the clock.

Manual configuration

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

Ensure that tzdata package is installed. 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:

# ln -s /usr/share/zoneinfo/Europe/Brussels /etc/localtime