Centos/linux Automatically synchronize server time

Source: Internet
Author: User
Tags time zones

The newly installed CentOS system server may have set the wrong time, time is very important when doing the cluster, it is likely that the cluster will fail because of the time, so you need to adjust the time zone and adjust the times. The following is a CentOS system that uses NTP to synchronize time from a time server to synchronize time at timed intervals.

Ntp:network time protocol, known as the Network Timing protocol, is the standard Internet Protocol for time synchronization in the Internet. The purpose of NTP is to synchronize the computer's time to a certain time standard. The time standard currently in use is UTC at World coordination Time (Universal-coordinated).

The CentOS system time synchronization steps are as follows:

1. Download Ntpdate
Note: Some versions are not self-ntpdate and therefore need to be downloaded
# yum Install-y ntpdate

2. Adjust the time zone toShanghai, +8 District, Beijing time
Note: You can also go to the/usr/share/zoneinfo directory if you want to change other time zones
# Cp/usr/share/zoneinfo/asia/shanghai/etc/localtime
# Yes | Cp-f/usr/share/zoneinfo/asia/shanghai/etc/localtime

3. Use NTP to synchronize time
# ntpdate us.pool.ntp.org

4, timing synchronization time (every 10 minutes synchronous clock)
# crontab-l >/tmp/crontab.bak
# echo "*/10 * * * * */usr/sbin/ntpdate us.pool.ntp.org | Logger-t NTP ">>/tmp/crontab.bak
# Crontab/tmp/crontab.bak

So we can solve the problem of time.

Centos/linux Automatically synchronize server time

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.