How does CentOS7 modify the system time? OpenVZ sync timezone to NTP server

OnThe system time setting is wrong under Linux, how to modify the synchronization?

How does CentOS7 modify the system time? OpenVZ sync timezone to NTP server

The easiest way is to quickly configure OpenVZ to synchronize the time zone to the NTP server via SSH commands.

  • NTP English full name isNetwork Time Protocol.

What is OpenVZ?

  • OpenVZ is based onLinuxOS-level virtualization technology for the kernel.
  • OpenVZ allows physical servers to run multiple operating systems, a technology commonly used in virtual private servers.

First, delete the local time zone ▼

rm -rf /etc/localtime

Modify the time zone to +8 zone ▼

ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

View time zone settings▼

date -R

How to modifyCentOS 7 system time?

Next, modify the CentOS 7 system time and set the OpenVZ synchronization time zone to the NTP server to synchronize with the time server.

Install NTP ▼

yum install -y ntp

Debug view time difference ▼

ntpdate -d us.pool.ntp.org

Sync time ▼

ntpdate us.pool.ntp.org

Check if the time is synchronized ▼

date -R

Modify NTP configuration file▼

vi /etc/sysconfig/ntpd

Synchronize the hardware clock of a standalone host ▼

SYNC_HWCLOCK=yes

Configure to start the NTP service at startup, and automatically synchronize the time on a regular basis▼

systemctl enable ntpd.service

Start NTP synchronization ▼

systemctl start ntpd.service

Comment

Your email address will not be published. Required fields * Callout

Scroll to Top