How to modify and set CentOS system time

Source: Internet
Author: User
Tags current time time zones time and date centos

Centos time adjustment operation

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 you are not using CentOS, run the yum install ntp command.

Then: ntpdate us.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 RedHat Linux and CentOS systems
Timeconfig
Method (3) applicable to Debian
Dpkg-reconfigure tzdata

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
Data-s 06/22/96
Set the CentOS system time to 01:52:00 P.M..
Date-s 13: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/ntpdate 210.72.145.44>/dev/null 2> & 1
In this way, we have completed the problem of setting and modifying the CentOS system time zone. I hope you can learn more.

When ntpdate is used, the following error occurs:
No server suitable for synchronization found

It is likely that the firewall has blocked udp port 123. If the firewall is still disabled, it is likely that there is a problem with the upper-layer route settings, we can only update the time through tcp.
It must be rdate.

View the time of the time server:

# Rdate time.nist.gov

Set the time to synchronize with the time server:

# Rdate-s time.nist.gov
Please # man rdate

The following is a list of the series of time servers that may not be used.

Time.nist.gov
Time-b.nist.gov
216.118.116.105
Rdate.darkorb.net
202.106.196.19
Time-b.timefreq.bldrdoc.gov

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.