1. Check the current time zone
Log in as root.
Date Fri Sep 5 A:£ º
Where UTC refers to the currently used time system for world standard Time , also called World coordination Time . The English name is coordinated Universal time and the French name is Temps universel coordonné. As a compromise of the English abbreviation CUT and the French abbreviation TUC, referred to as UTC. The time zone in China is utc+8.
2. View available time zones
View the directory/usr/share/zoneinfo to see all time zones. (The list of time zones can vary depending on the Linux distribution.) )
# ls /usr/share/zoneinfoafrica Australia Cuba Etc GMT +0 Iceland Kwajalein NZ Poland Turkey WET rightamerica Brazil Europe GMT -0 Indian Libya nz-chat Portugal UCT Zulu Zone.tabantar Ctica CET EST Factory GMT0 Iran MET Navajo ROC US iso3166.tabarctic C ST6CDT Est5edt GB Greenwich Israel MST PRC ROK UTC localtimeasia Canada Egypt GB -eire HST Jamaica MST7MDT PST8PDT Singapore Universal POSIX Atlantic Chile Eire GMT Hongkong Japan Mexico Pacific systemv W -su posixrules
3. Set time zone 3.1. Setting the time zone manually
First, back up the current time zone configuration.
MV /etc/localtime/etc/localtime-old
Use the new time zone. You can find your city in the list of regions, and if you don't have a city, choose another city of the same time zone.
LN -sf/usr/share/zoneinfo/asia/shanghai/etc/localtime
After the configuration is complete, you can use the date command to see if it is already in effect.
3.2. Setting the time zone automatically
In Ubuntu, with the Set time Zone tool, Tzconfig is not recommended, use the Dpkg-reconfigure tzdata command to bring up the settings UI, follow the interface to indicate the settings to complete the time zone settings.
sudo dpkg-reconfigure tzdata
Popup dialog box:
After choosing a continent, then select the time zone city, Beijing Times select Shanghai can:
Time ' Asia/shanghai ' time is now: £ º Universal Time is now:::
4. Setting up the server to synchronize with the Internet time server
Most modern Linux distributions are already preloaded with NTP packages. If your server does not have it installed, you can install it manually.
1. Ubuntu/debian:
sudo Install NTP
2. CentOS:
sudo Yum Install sudo /sbin/chkconfig ntpd on
3. Fedora/redhat:
sudo Yum Install sudo chkconfig ntpd on
After the installation is complete, execute:
$ ntpdate && Hwclock-w
Or synchronize time with cn.pool.ntp.org, the site is an NTP public server located in China:
sudo ntpdate cn.pool.ntp.org - £ ºntpdate[2057time202.112. 29.820.017623 sec
Report:
1.3 Ways To change the Timezone in Linux
2. How to Set up synchronization on Ubuntu 12.04
3. Tzconfig (deprecated)
4. Dpkg-reconfigure Tzdata
[Linux] Setting the system time zone