When we use the CentOS system, problems may occur frequently in the time zone, and sometimes errors may occur after the change. Next we will learn a way to change this situation. If the CentOS system is not installed, run the yuminstallntp command.
Then: ntpdateus.pool.ntp.org.
Because the CentOS system is re-compiled with the source code of rhas, many places are exactly the same.
The Time Zone of rhas5 exists as a file. The current time zone file is in/etc/localtime.
So where are files stored in other time zones?
Under/usr/share/zoneinfo
We use UTC + 8, Beijing, and Shanghai time.
# Cp-f/usr/share/zoneinfo/Asia/Shanghai/etc/localtime
# Reboot
After the restart, view the time in date, view the current time zone date-R, view/modify the Linux time zone and time
I. Time Zone
1. view the current time zone
Date-R
2. Modify the time zone
Method (1)
Tzselect
Method (2) Limited to RedHatLinux and CentOS Systems
Timeconfig
Method (3) applicable to Debian
Dpkg-reconfiguretzdata
3. Copy the corresponding time zone file, replace the CentOS System Time Zone file, or create a link file.
Cp/usr/share/zoneinfo/$ main Time Zone/$ Time Zone/etc/localtime
Available in China:
Cp/usr/share/zoneinfo/Asia/Shanghai/etc/localtime
Ii. Time
1. view the time and date
Date
2. Set the time and date
Set the CentOS system date to the June 10, 1996 command
Date-s06/22/96
Set the CentOS system time to 01:52:00 P.M..
Date-s13: 52: 00
3. Write the current time and date to the BIOS to prevent failure after restart
Hwclock-w
Iii. Scheduled synchronization time
#/Usr/sbin/ntpdate210.72.145.44>/dev/null2> & 1
In this way, we have completed the problem of setting and modifying the CentOS system time zone. I hope you can learn more.