RedHat Linux作業系統修改時區的方法

perfychi發表於2013-08-29

(1)

Here is an example of changing the timezone: (Logged in as root)

  In order to manually change the timezone, you can edit the /etc/sysconfig/clockfile and then make a new soft link to /etc/localtime. Here is an example of changing the timezone manually to “America/Denver”:

  1. Select the appropriate time zone from the /usr/share/zoneinfo directory. Time zone names are relative to that directory. In this case, we will select “America/Denver”

  2. Edit the /etc/sysconfig/clocktext file so that it looks like this:

  ZONE=”America/Denver”

  UTC=true

  ARC=false

  Of course, this assumes that your hardware clock is running UTC time…

  3. Delete the following file: /etc/localtime (backup it when you need it !)

  4. Create a new soft link for /etc/localtime. Here is an example of step 3 and step 4:

  # cd /etc

  # ls -al localtime

  lrwxrwxrwx 1 root root 39 Mar 28 07:00 localtime -> /usr/share/zoneinfo/America/Los_Angeles

  # rm /etc/localtime

  # ln -s /usr/share/zoneinfo/America/Denver /etc/localtime

  # ls -al localtime

  lrwxrwxrwx 1 root root 34 Mar 28 08:59 localtime -> /usr/share/zoneinfo/America/Denver

  # date


(2)

檢視/修改Linux時區和時間

 

一、時區

1. 檢視當前時區

date -R

2. 修改設定時區

方法(1)

tzselect

方法(2) 僅限於RedHat Linux 和 CentOS

timeconfig

方法(3) 適用於Debian

dpkg-reconfigure tzdata

3. 複製相應的時區檔案,替換系統時區檔案;或者建立連結檔案

cp /usr/share/zoneinfo/$主時區/$次時區 /etc/localtime

在中國可以使用:

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

3. 將當前時間和日期寫入BIOS,避免重啟後失效

hwclock -w

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27042095/viewspace-769630/,如需轉載,請註明出處,否則將追究法律責任。

相關文章